Compare commits

..

1 Commits

Author SHA1 Message Date
Teddy Cornaut a6927e26ce Fix php error 2022-04-07 13:29:05 +02:00
17 changed files with 25 additions and 423 deletions

2
.gitignore vendored
View File

@ -7,5 +7,3 @@
/public/bundles/ /public/bundles/
/var/ /var/
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
/supervisord.log
/supervisord.pid

View File

@ -1,3 +1,3 @@
# index: index:
# path: / path: /loginAppSaml
# controller: App\Controller\MainController:: controller: App\Controller\MainController::loginAppSaml

View File

@ -8,7 +8,7 @@
# Using SetHandler avoids issues with using ProxyPassMatch in combination # Using SetHandler avoids issues with using ProxyPassMatch in combination
# with mod_rewrite or mod_autoindex # with mod_rewrite or mod_autoindex
<FilesMatch \.php$> <FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://127.0.0.1:9000" SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://127.0.0.1:9000"
# for Unix sockets, Apache 2.4.10 or higher # for Unix sockets, Apache 2.4.10 or higher
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy # SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
</FilesMatch> </FilesMatch>

View File

@ -1,4 +1,4 @@
FROM ubuntu:22.04 FROM ubuntu:20.04
ARG HTTP_PROXY= ARG HTTP_PROXY=
ARG HTTPS_PROXY= ARG HTTPS_PROXY=
@ -7,7 +7,7 @@ ARG https_proxy=
ENV WAITFORIT_VERSION="v2.4.1" ENV WAITFORIT_VERSION="v2.4.1"
ARG PHP_VERSION="8.1" ARG PHP_VERSION="7.4"
ENV PHP_VERSION $PHP_VERSION ENV PHP_VERSION $PHP_VERSION
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
@ -17,7 +17,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && \ apt-get update -y && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
git bash wget ca-certificates supervisor cron rsyslog mysql-client jq \ git bash wget ca-certificates supervisor cron rsyslog mysql-client jq \
mutt tree vim python3-setuptools python3-pip make \ mutt tree vim python python3 python3-setuptools python3-pip make \
php${PHP_VERSION}-cli php${PHP_VERSION}-ldap php${PHP_VERSION}-soap \ php${PHP_VERSION}-cli php${PHP_VERSION}-ldap php${PHP_VERSION}-soap \
php${PHP_VERSION}-intl php${PHP_VERSION}-curl php${PHP_VERSION}-gd \ php${PHP_VERSION}-intl php${PHP_VERSION}-curl php${PHP_VERSION}-gd \
php${PHP_VERSION}-xml php${PHP_VERSION}-bcmath \ php${PHP_VERSION}-xml php${PHP_VERSION}-bcmath \
@ -58,14 +58,14 @@ RUN chmod +x /loginapp/install-composer.sh &&\
# On active les mods d'apache nécessaires # On active les mods d'apache nécessaires
RUN a2enmod rewrite RUN a2enmod rewrite
RUN a2enmod proxy_fcgi setenvif RUN a2enmod proxy_fcgi setenvif
RUN a2enconf php8.1-fpm RUN a2enconf php7.4-fpm
RUN a2enmod proxy RUN a2enmod proxy
RUN a2enmod expires RUN a2enmod expires
RUN a2enmod headers RUN a2enmod headers
# On injecte les bonnes configs apache et php-fpm # On injecte les bonnes configs apache et php-fpm
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
COPY www.conf /etc/php/8.1/fpm/pool.d/www.conf COPY www.conf /etc/php/7.4/fpm/pool.d/www.conf
EXPOSE 5000 EXPOSE 5000
EXPOSE 80 EXPOSE 80
@ -73,8 +73,8 @@ EXPOSE 80
WORKDIR /loginapp WORKDIR /loginapp
# On démarre php-fpm une fois pour créer les sockets # On démarre php-fpm une fois pour créer les sockets
RUN service php8.1-fpm start RUN service php7.4-fpm start
RUN service php8.1-fpm stop RUN service php7.4-fpm stop
COPY docker-entrypoint.sh /docker-entrypoint.sh COPY docker-entrypoint.sh /docker-entrypoint.sh
@ -89,7 +89,7 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
COPY rsyslog.conf /etc/rsyslog.d/loginapp.conf COPY rsyslog.conf /etc/rsyslog.d/loginapp.conf
COPY supervisor.ini /etc/supervisor/supervisor.ini COPY supervisor.ini /etc/supervisor/supervisor.ini
COPY php.ini /etc/php/8.1/fpm/php.ini COPY php.ini /etc/php/7.4/fpm/php.ini
VOLUME /container-lifecycle VOLUME /container-lifecycle

View File

@ -26,7 +26,7 @@ stderr_logfile_maxbytes=0
[program:php-fpm] [program:php-fpm]
environment=HOSTNAME="%(ENV_HOSTNAME)s" environment=HOSTNAME="%(ENV_HOSTNAME)s"
command = /usr/sbin/php-fpm8.1 -F command = /usr/sbin/php-fpm7.4 -F
autostart = true autostart = true
autorestart = true autorestart = true
directory = /loginapp directory = /loginapp

View File

@ -6,7 +6,7 @@ error_log=/dev/stderr
user = www-data user = www-data
group = www-data group = www-data
listen = /run/php/php8.1-fpm.sock listen = /run/php/php7.4-fpm.sock
listen.owner = www-data listen.owner = www-data
listen.group = www-data listen.group = www-data

View File

@ -1,13 +1,18 @@
<?php <?php
namespace App\Controller; namespace App\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class MainController extends AbstractController class MainController extends AbstractController
{ {
/**
* @Route("/loginAppSaml", name="login_app_saml")
} */
public function loginAppSaml(Request $request)
{
return new Response('saml');
}
}

View File

@ -4012,23 +4012,3 @@
2022-04-07 12:57:41,576 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2022-04-07 12:57:41,576 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 12:57:41,576 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2022-04-07 12:57:41,576 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 12:57:41,576 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2022-04-07 12:57:41,576 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 13:28:49,188 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2022-04-07 13:28:49,190 INFO RPC interface 'supervisor' initialized
2022-04-07 13:28:49,190 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2022-04-07 13:28:49,191 INFO supervisord started with pid 26
2022-04-07 13:28:50,194 INFO spawned: 'apache2' with pid 28
2022-04-07 13:28:50,197 INFO spawned: 'php-fpm' with pid 29
2022-04-07 13:28:50,199 INFO spawned: 'rsyslog' with pid 30
2022-04-07 13:28:51,229 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 13:28:51,229 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 13:28:51,229 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 14:27:06,256 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
2022-04-07 14:27:06,258 INFO RPC interface 'supervisor' initialized
2022-04-07 14:27:06,258 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2022-04-07 14:27:06,258 INFO supervisord started with pid 26
2022-04-07 14:27:07,261 INFO spawned: 'apache2' with pid 27
2022-04-07 14:27:07,264 INFO spawned: 'php-fpm' with pid 28
2022-04-07 14:27:07,265 INFO spawned: 'rsyslog' with pid 29
2022-04-07 14:27:08,292 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 14:27:08,292 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-04-07 14:27:08,292 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

View File

@ -1 +1 @@
26 12

View File

@ -1,15 +0,0 @@
<?php
namespace Psr\Log;
/**
* This is a simple Logger implementation that other Loggers can inherit from.
*
* It simply delegates all log-level-specific methods to the `log` method to
* reduce boilerplate code that a simple Logger that does the same thing with
* messages regardless of the error level has to implement.
*/
abstract class AbstractLogger implements LoggerInterface
{
use LoggerTrait;
}

View File

@ -1,7 +0,0 @@
<?php
namespace Psr\Log;
class InvalidArgumentException extends \InvalidArgumentException
{
}

View File

@ -1,18 +0,0 @@
<?php
namespace Psr\Log;
/**
* Describes log levels.
*/
class LogLevel
{
const EMERGENCY = 'emergency';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
}

View File

@ -1,18 +0,0 @@
<?php
namespace Psr\Log;
/**
* Describes a logger-aware instance.
*/
interface LoggerAwareInterface
{
/**
* Sets a logger instance on the object.
*
* @param LoggerInterface $logger
*
* @return void
*/
public function setLogger(LoggerInterface $logger);
}

View File

@ -1,26 +0,0 @@
<?php
namespace Psr\Log;
/**
* Basic Implementation of LoggerAwareInterface.
*/
trait LoggerAwareTrait
{
/**
* The logger instance.
*
* @var LoggerInterface|null
*/
protected ?LoggerInterface $logger = null;
/**
* Sets a logger.
*
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View File

@ -1,125 +0,0 @@
<?php
namespace Psr\Log;
/**
* Describes a logger instance.
*
* The message MUST be a string or object implementing __toString().
*
* The message MAY contain placeholders in the form: {foo} where foo
* will be replaced by the context data in key "foo".
*
* The context array can contain arbitrary data. The only assumption that
* can be made by implementors is that if an Exception instance is given
* to produce a stack trace, it MUST be in a key named "exception".
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
* for the full interface specification.
*/
interface LoggerInterface
{
/**
* System is unusable.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function emergency(string|\Stringable $message, array $context = []);
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function alert(string|\Stringable $message, array $context = []);
/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function critical(string|\Stringable $message, array $context = []);
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function error(string|\Stringable $message, array $context = []);
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function warning(string|\Stringable $message, array $context = []);
/**
* Normal but significant events.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function notice(string|\Stringable $message, array $context = []);
/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function info(string|\Stringable $message, array $context = []);
/**
* Detailed debug information.
*
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*/
public function debug(string|\Stringable $message, array $context = []);
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string|\Stringable $message
* @param mixed[] $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, string|\Stringable $message, array $context = []);
}

View File

@ -1,142 +0,0 @@
<?php
namespace Psr\Log;
/**
* This is a simple Logger trait that classes unable to extend AbstractLogger
* (because they extend another class, etc) can include.
*
* It simply delegates all log-level-specific methods to the `log` method to
* reduce boilerplate code that a simple Logger that does the same thing with
* messages regardless of the error level has to implement.
*/
trait LoggerTrait
{
/**
* System is unusable.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function emergency(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function alert(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::ALERT, $message, $context);
}
/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function critical(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::CRITICAL, $message, $context);
}
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function error(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::ERROR, $message, $context);
}
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function warning(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::WARNING, $message, $context);
}
/**
* Normal but significant events.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function notice(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::NOTICE, $message, $context);
}
/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function info(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::INFO, $message, $context);
}
/**
* Detailed debug information.
*
* @param string|\Stringable $message
* @param array $context
*
* @return void
*/
public function debug(string|\Stringable $message, array $context = [])
{
$this->log(LogLevel::DEBUG, $message, $context);
}
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string|\Stringable $message
* @param array $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
abstract public function log($level, string|\Stringable $message, array $context = []);
}

View File

@ -1,30 +0,0 @@
<?php
namespace Psr\Log;
/**
* This Logger can be used to avoid conditional log calls.
*
* Logging should always be optional, and if no logger is provided to your
* library creating a NullLogger instance to have something to throw logs at
* is a good way to avoid littering your code with `if ($this->logger) { }`
* blocks.
*/
class NullLogger extends AbstractLogger
{
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string|\Stringable $message
* @param array $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, string|\Stringable $message, array $context = [])
{
// noop
}
}