From bf867f83b0d8f626f3a9714b047ce65dce0d6bb2 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Mon, 24 Jun 2024 08:32:32 -0400 Subject: [PATCH] use php version 8.3 for ubuntu 24.04 --- opt/cs50/bin/passenger | 16 ++++++++-------- opt/cs50/etc/nginx.conf.erb | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/opt/cs50/bin/passenger b/opt/cs50/bin/passenger index 205efd3..5ba4a74 100644 --- a/opt/cs50/bin/passenger +++ b/opt/cs50/bin/passenger @@ -1,22 +1,22 @@ #!/bin/bash # Inject environment variables into pool -sed -i '/^env\[.\+\] *=.*/d' /etc/php/8.1/fpm/pool.d/www.conf -env | grep -v ^PASSENGER_ | grep -v =$ | sed 's/\([^=]\+\)=\(.*\)/env[\1]=\"\2\"/' | awk 'length <= 1024' >> /etc/php/8.1/fpm/pool.d/www.conf +sed -i '/^env\[.\+\] *=.*/d' /etc/php/8.3/fpm/pool.d/www.conf +env | grep -v ^PASSENGER_ | grep -v =$ | sed 's/\([^=]\+\)=\(.*\)/env[\1]=\"\2\"/' | awk 'length <= 1024' >> /etc/php/8.3/fpm/pool.d/www.conf # Enable Xdebug (and other PHP-recommended directives) in development mode if [ "$APPLICATION_ENV" == "dev" ]; then - phpenmod xdebug && cp -f /usr/lib/php/8.1/php.ini-development /etc/php/8.1/fpm/php.ini + phpenmod xdebug && cp -f /usr/lib/php/8.3/php.ini-development /etc/php/8.3/fpm/php.ini else - phpdismod xdebug && cp -f /usr/lib/php/8.1/php.ini-production /etc/php/8.1/fpm/php.ini + phpdismod xdebug && cp -f /usr/lib/php/8.3/php.ini-production /etc/php/8.3/fpm/php.ini fi # Match Nginx's client_max_body_size -sed -i 's/post_max_size\s*=.*/post_max_size = 1024M/' /etc/php/8.1/fpm/php.ini -sed -i 's/upload_max_filesize\s*=.*/upload_max_filesize = 1024M/' /etc/php/8.1/fpm/php.ini +sed -i 's/post_max_size\s*=.*/post_max_size = 1024M/' /etc/php/8.3/fpm/php.ini +sed -i 's/upload_max_filesize\s*=.*/upload_max_filesize = 1024M/' /etc/php/8.3/fpm/php.ini # Start PHP-FPM -/etc/init.d/php8.1-fpm start +/etc/init.d/php8.3-fpm start # Default to production mode PASSENGER_ENVIRONMENT="production" @@ -59,4 +59,4 @@ if [ "$APPLICATION_ENV" == "dev" ]; then fi # Stop PHP-FPM -/etc/init.d/php8.1-fpm stop +/etc/init.d/php8.3-fpm stop diff --git a/opt/cs50/etc/nginx.conf.erb b/opt/cs50/etc/nginx.conf.erb index 275f359..7c8a91a 100644 --- a/opt/cs50/etc/nginx.conf.erb +++ b/opt/cs50/etc/nginx.conf.erb @@ -161,7 +161,7 @@ http { fastcgi_param HTTP_X_FORWARDED_SERVER $host; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SERVER_NAME $host; - fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; + fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.+)$; include /opt/cs50/etc/fastcgi_params; try_files $uri =404;