Created
March 24, 2025 00:49
-
-
Save bobwol/ae1c2355f59d227e3350b189ed0eff13 to your computer and use it in GitHub Desktop.
Revisions
-
bobwol created this gist
Mar 24, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ # How to install php7.4-fpm with Ubuntu -------- ### Add php7.4 repository ``` sudo add-apt-repository ppa:ondrej/php sudo apt-get update ``` ### Install php7.4-fpm ``` apt install php7.4-common php7.4-cli php7.4-zip php7.4-opcache php7.4-mysql php7.4-mbstring php7.4-json php7.4-intl php7.4-gd php7.4-fpm php7.4-curl php7.4-bz2 php7.4-bcmath php7.4-imap php7.4-recode php7.4-soap php7.4-xml php7.4-imagick php7.4-memcache php7.4-memcached php7.4-igbinary php7.4-msgpack php7.4-redis ``` **Copy the php7.4-fpm pool configuration from php7.0-fpm** ``` cp -f /etc/php/7.0/fpm/pool.d/www.conf /etc/php/7.4/fpm/pool.d/www.conf ``` **Edit the listening port of php7.4-fpm (for example 9074 instead of 9070)** ``` nano /etc/php/7.4/fpm/pool.d/www.conf ``` Replace the line `listen = 127.0.0.1:9070` by `listen = 127.0.0.1:9074`<br> Restart the service ``` service php7.4-fpm restart ``` Then to use php7.4-fpm, you have the choice between -------- ### 1) Replace globally php7.0-fpm with php7.4-fpm In this case just edit the file /etc/nginx/conf.d/upstream.conf and replace the line `server 127.0.0.1:9070;` by `server 127.0.0.1:9074;`<br> ``` nano /etc/nginx/conf.d/upstream.conf ``` Then reload nginx ``` service nginx restart ``` -------- ### 2) Add php7.4-fpm as an additional php version Add the following lines in /etc/nginx/conf.d/upstream.conf ``` upstream php74 { server 127.0.0.1:9074; } ``` then copy the files /etc/nginx/common/php7.conf into /etc/nginx/common/php74.conf<br> And into this copy replace the line `fastcgi_pass php7;` by `fastcgi_pass php74;`<br> Reload nginx and you can replace the line `include common/php7.conf;` by `include common/php74.conf;` in the vhosts of your choice<br>