diff --git a/.env b/.env index 5c4482a..76d37e7 100644 --- a/.env +++ b/.env @@ -17,6 +17,7 @@ ENABLE_SCRIPT_SERVER=1 # Default services configuration # PHP PHP_COVERAGE_OUTPUT_FOLDER=/opt/phpstorm-coverage +PHP_PROFILE_OUTPUT_FOLDER=/opt/phpstorm-profile # Apache ports APACHE_PORT_AUTO=88 @@ -27,6 +28,7 @@ APACHE_PORT_81=81 APACHE_PORT_82=82 APACHE_PORT_83=83 APACHE_PORT_84=84 +APACHE_PORT_85=85 # Nginx ports (only used if ENABLE_NGINX=1) NGINX_PORT_AUTO=88 @@ -37,6 +39,7 @@ NGINX_PORT_81=81 NGINX_PORT_82=82 NGINX_PORT_83=83 NGINX_PORT_84=84 +NGINX_PORT_85=85 # Database ports MARIADB_PORT=3306 @@ -54,6 +57,9 @@ MAILPIT_RELAY_MATCHING='(user\.combodo@gmail\.com|user@combodo\.com)' # Script server SCRIPT_SERVER_PORT=8090 +# kCacheGrind +KCACHE_GRIND_WEB_PORT=8088 + # SMTP password COMBODO_SMTP_TEST_PASSWORD=!passboltpassword! diff --git a/addons/chrome_extension/assets/js/background.js b/addons/chrome_extension/assets/js/background.js index d166d5b..75ad76f 100644 --- a/addons/chrome_extension/assets/js/background.js +++ b/addons/chrome_extension/assets/js/background.js @@ -4,7 +4,7 @@ const optionsDTO = { php_version: '82', url_filter: 'localhost', enabled: 'true', - php_version_installed: '{"74":"7.4","80":"8.0","81":"8.1","82":"8.2","83":"8.3","84":"8.4"}' + php_version_installed: '{"74":"7.4","80":"8.0","81":"8.1","82":"8.2","83":"8.3","84":"8.4","85":"8.5"}' }; // update badge from stored options diff --git a/addons/chrome_extension/assets/js/optionsDTO.js b/addons/chrome_extension/assets/js/optionsDTO.js deleted file mode 100644 index 7f1cd03..0000000 --- a/addons/chrome_extension/assets/js/optionsDTO.js +++ /dev/null @@ -1,6 +0,0 @@ -const optionsDTO = { - php_version: '82', - url_filter: 'localhost', - enabled: 'true', - php_version_installed: '{74: "7.4",80: "8.0",81: "8.1",82: "8.2",83: "8.3",84: "8.4"}' -}; \ No newline at end of file diff --git a/addons/chrome_extension/manifest.json b/addons/chrome_extension/manifest.json index ce5b1de..30da4c4 100644 --- a/addons/chrome_extension/manifest.json +++ b/addons/chrome_extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "PHP Version Selector", - "version": "1.1", + "version": "1.2", "description": "Select PHP version by modifying HTTP header request", "options_ui": { "page": "./pages/options.html", diff --git a/addons/chrome_extension/manifest_chrome.json b/addons/chrome_extension/manifest_chrome.json index ce5b1de..30da4c4 100644 --- a/addons/chrome_extension/manifest_chrome.json +++ b/addons/chrome_extension/manifest_chrome.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "PHP Version Selector", - "version": "1.1", + "version": "1.2", "description": "Select PHP version by modifying HTTP header request", "options_ui": { "page": "./pages/options.html", diff --git a/addons/chrome_extension/manifest_firefox.json b/addons/chrome_extension/manifest_firefox.json index 92218b9..c9c911c 100644 --- a/addons/chrome_extension/manifest_firefox.json +++ b/addons/chrome_extension/manifest_firefox.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "PHP Version Selector", - "version": "1.1", + "version": "1.2", "description": "Select PHP version by modifying HTTP header request", "options_ui": { "page": "./pages/options.html", diff --git a/addons/chrome_extension/web-ext-artifacts/php_version_selector-1.1.zip b/addons/chrome_extension/web-ext-artifacts/php_version_selector-1.1.zip deleted file mode 100644 index f5c2766..0000000 Binary files a/addons/chrome_extension/web-ext-artifacts/php_version_selector-1.1.zip and /dev/null differ diff --git a/addons/chrome_extension/web-ext-artifacts/php_version_selector-1.2.zip b/addons/chrome_extension/web-ext-artifacts/php_version_selector-1.2.zip new file mode 100644 index 0000000..c186c50 Binary files /dev/null and b/addons/chrome_extension/web-ext-artifacts/php_version_selector-1.2.zip differ diff --git a/addons/docker_scripts/build.sh b/addons/docker_scripts/build.sh index 17f810a..386b1d7 100755 --- a/addons/docker_scripts/build.sh +++ b/addons/docker_scripts/build.sh @@ -1,2 +1,2 @@ cd ../../ -docker-compose build --no-cache \ No newline at end of file +docker compose build --no-cache \ No newline at end of file diff --git a/addons/docker_scripts/down.sh b/addons/docker_scripts/down.sh index 58694d0..1412b2e 100755 --- a/addons/docker_scripts/down.sh +++ b/addons/docker_scripts/down.sh @@ -1 +1,2 @@ -docker-compose down \ No newline at end of file +cd ../../ +docker compose --env-file .env.local down \ No newline at end of file diff --git a/addons/docker_scripts/down_and_up.sh b/addons/docker_scripts/down_and_up.sh new file mode 100644 index 0000000..434b9bc --- /dev/null +++ b/addons/docker_scripts/down_and_up.sh @@ -0,0 +1,3 @@ +cd ../../ +docker compose --env-file .env.local down +docker compose --env-file .env.local up -d \ No newline at end of file diff --git a/addons/docker_scripts/restart_php.sh b/addons/docker_scripts/restart_php.sh new file mode 100644 index 0000000..15ad1c7 --- /dev/null +++ b/addons/docker_scripts/restart_php.sh @@ -0,0 +1,10 @@ +cd ../../ +# Affichage en couleur +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' # No Color + +echo -e "${RED}Stopping PHP containers...${NC}" +docker ps -a --format '{{.Names}}' | grep '^php[0-9]' | xargs -r docker stop +echo -e "${GREEN}Starting PHP containers...${NC}" +docker ps -a --format '{{.Names}}' | grep '^php[0-9]' | xargs -r docker start diff --git a/addons/docker_scripts/up.sh b/addons/docker_scripts/up.sh index 4e0b56c..ecbfaa6 100755 --- a/addons/docker_scripts/up.sh +++ b/addons/docker_scripts/up.sh @@ -1,2 +1,2 @@ cd ../../ -docker-compose --env-file .env.local up -d \ No newline at end of file +docker compose --env-file .env.local up -d \ No newline at end of file diff --git a/addons/documentation/how_to.md b/addons/documentation/how_to.md index de3d465..1ce8fdd 100644 --- a/addons/documentation/how_to.md +++ b/addons/documentation/how_to.md @@ -271,6 +271,13 @@ https://mailpit.axllent.org/docs/configuration/smtp-relay/ * Add a configuration file in `conf/script-server/config/runners` folder describing your script (name, description, parameters, ... Full documentation [here](https://github.com/bugy/script-server/wiki/Script-config)). * Restart the script-server container. +## kCacheGrind + +### Open a cachegrind file + + * Open the kcachegrind application http://localhost:8088/vnc.html?path=vnc&autoconnect=true&resize=remote&reconnect=true&show_dot=true. + * Click on "File" then "Open" and select the cachegrind file you want to open from the `data` folder. + \ \ diff --git a/addons/documentation/images/docker_infra.png b/addons/documentation/images/docker_infra.png index 54c55f2..411a725 100644 Binary files a/addons/documentation/images/docker_infra.png and b/addons/documentation/images/docker_infra.png differ diff --git a/build/default_configuration/php/php.ini b/build/default_configuration/php/php.ini index 767ae98..dd6f705 100644 --- a/build/default_configuration/php/php.ini +++ b/build/default_configuration/php/php.ini @@ -1,12 +1,12 @@ memory_limit=512M max_execution_time = 300 display_errors = On +log_errors = On display_startup_errors = On html_errors = On error_reporting = E_ALL -zend_extension=opcache -opcache.enable=1 -upload_max_filesize = 190M +opcache.enable=0 +upload_max_filesize = 64M post_max_size = 200M max_input_vars = 5000 ;allow_url_fopen = Off diff --git a/build/default_configuration/php/xdebug.ini b/build/default_configuration/php/xdebug.ini index 63a3e7a..5798f16 100644 --- a/build/default_configuration/php/xdebug.ini +++ b/build/default_configuration/php/xdebug.ini @@ -1,2 +1,4 @@ -xdebug.mode=debug -xdebug.client_host=host.docker.internal \ No newline at end of file +xdebug.mode=debug,coverage,profile +xdebug.client_host=host.docker.internal +xdebug.output_dir=/opt/phpstorm-profile +xdebug.start_with_request = trigger \ No newline at end of file diff --git a/build/php b/build/php index bae5184..104fbee 100644 --- a/build/php +++ b/build/php @@ -7,6 +7,7 @@ ARG XDEBUG_VERSION ARG UID=1000 ARG GID=1000 +# Make sure www-data user has the same uid/gid as the host user to avoid permission issues RUN usermod -u ${UID} www-data && groupmod -g ${GID} www-data # Install @procps for "ps" & "pgrep" commands @@ -15,11 +16,11 @@ RUN apt-get update && apt-get install -y procps # Install @mariadb-client & @graphviz RUN apt-get update && apt-get install mariadb-client graphviz -y -# install php extensions +# Install php extensions COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ - RUN install-php-extensions gd xdebug apcu imap mysqli soap zip ldap +# install Composer RUN set -eux; \ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ php -r "if (hash_file('sha384', 'composer-setup.php') === 'c8b085408188070d5f52bcfe4ecfbee5f727afa458b2573b8eaaf77b3419b0bf2768dc67c86944da1544f06fa544fd47') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" && \ diff --git a/docker-compose.yml b/docker-compose.yml index 864c769..63a500d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ x-php: &default-php - ${CONF_FOLDER}/msmtprc/msmtprc:/var/www/.msmtprc:ro - ${HTML_FOLDER}:/var/www/html/ - ${DATA_FOLDER}/php/coverage:${PHP_COVERAGE_OUTPUT_FOLDER} + - ${DATA_FOLDER}/php/profile:${PHP_PROFILE_OUTPUT_FOLDER} restart: always services: @@ -84,6 +85,15 @@ services: IMAGE: php:8.4-fpm XDEBUG_VERSION: 3.4.5 + php85: + <<: *default-php + container_name: php8.5 + build: + <<: *default-php-build + args: + IMAGE: php:8.5-fpm + XDEBUG_VERSION: 3.4.5 + apache: container_name: apache build: @@ -101,6 +111,7 @@ services: - "${APACHE_PORT_82:-82}:82" - "${APACHE_PORT_83:-83}:83" - "${APACHE_PORT_84:-84}:84" + - "${APACHE_PORT_85:-85}:85" volumes: - ${CONF_FOLDER}/apache/httpd.conf:/usr/local/apache2/conf/httpd.conf - ${CONF_FOLDER}/apache/httpd-vhosts.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf @@ -114,6 +125,7 @@ services: # - php82 # - php83 # - php84 +# - php85 deploy: replicas: ${ENABLE_APACHE:-0} @@ -134,6 +146,7 @@ services: - "${NGINX_PORT_82:-82}:82" - "${NGINX_PORT_83:-83}:83" - "${NGINX_PORT_84:-84}:84" + - "${NGINX_PORT_85:-85}:85" volumes: - ${CONF_FOLDER}/nginx:/etc/nginx/conf.d - ${CONF_FOLDER}/certs:/etc/nginx/certs @@ -146,6 +159,7 @@ services: # - php82 # - php83 # - php84 +# - php85 deploy: replicas: ${ENABLE_NGINX:-0} @@ -228,3 +242,12 @@ services: - TZ=Europe/Paris deploy: replicas: ${ENABLE_SCRIPT_SERVER:-0} + + kcachegrind: + image: nedix/kcachegrind + ports: + - ${KCACHE_GRIND_WEB_PORT:-8088}:80 + volumes: + - ${DATA_FOLDER}/php/profile:/data + + diff --git a/readme.md b/readme.md index 5216eee..0f8fada 100644 --- a/readme.md +++ b/readme.md @@ -50,7 +50,7 @@ The containers in charge of serving the web pages. * `82` Serve pages based on PHP 8.2. * `83` Serve pages based on PHP 8.3. * `84` Serve pages based on PHP 8.4. - +* `85` Serve pages based on PHP 8.5. * `88` (Automatic Mode) To serve pages based on PHP version passed in request header `X-PHP-Version`. * `443` (Automatic Mode) To serve pages based on PHP version passed in request header `X-PHP-Version` with `HTTPS` protocol. @@ -161,7 +161,15 @@ Based on `bugy/script-server` image. #### Default Listened Ports * `8090` WebUI +### kCacheGrind +The container for xdebug profile analyze. + +Web GUI to inspect Valgrind and Xdebug profiling reports. +🐳 [Docker official image page](https://hub.docker.com/r/nedix/kcachegrind) + +#### Default Listened Ports +* `8088` WebUI