Skip to content

Commit

Permalink
use php version 8.3 for ubuntu 24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
rongxin-liu committed Jun 24, 2024
1 parent 7c1288e commit bf867f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions opt/cs50/bin/passenger
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion opt/cs50/etc/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bf867f8

Please sign in to comment.