Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rhand's avatar
Level 6

Laravel Forge still running old PHP 7 version

I tried to remove PHP 7.4 on Laravel Forge servers, which is installed and not a default as I chose PHP 8, but then got the warning:

The domain.com site is actively using this version of PHP. Please remove the site or change its PHP version before uninstalling PHP 7.4.

Main Server

And yes, I do see PHP 7.4 run by root

forge@site-w-2:~/site.com/current$ ps aux |grep php/7.4
root     1081318  0.0  0.3 100204 29752 ?        Ss   Nov03   0:32 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
forge    1259014  0.0  0.0   8160  2400 pts/0    S+   00:28   0:00 grep --color=auto php/7.4

but all main processes are using PHP 8.0:

forge@site-prod-w-2:~/site.com/current$ ps aux |grep php
root      704481  0.0  0.3 246592 24820 ?        Ss   Oct23   1:35 php-fpm: master process (/etc/php/8.0/fpm/php-fpm.conf)
forge     704482  0.0  0.1 247032 11248 ?        S    Oct23   0:00 php-fpm: pool www
forge     704483  0.0  0.1 247032 11248 ?        S    Oct23   0:00 php-fpm: pool www
root     1081318  0.0  0.3 100204 29752 ?        Ss   Nov03   0:32 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
forge    1245115  0.1  0.8 140040 65292 ?        S    Nov08   0:41 php8.0 artisan horizon
forge    1245124  0.0  0.7 137992 64800 ?        S    Nov08   0:41 /usr/bin/php8.0 artisan horizon:supervisor site-prod-w-2-2ubE:supervisor-1 redis --workers-name=default --balance=auto --max-processes=10 --min-processes=1 --nice=0 --balance-cooldown=3 --balance-max-shift=1 --parent-id=1245115 --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue=default,ssl-manager --sleep=3 --timeout=300 --tries=3 --rest=0
forge    1245141  0.0  0.8 140044 65372 ?        S    Nov08   0:13 /usr/bin/php8.0 artisan horizon:work redis --name=default --supervisor=site-prod-w-2-2ubE:supervisor-1 --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue=ssl-manager --sleep=3 --timeout=300 --tries=3 --rest=0
forge    1245219  0.0  0.9 225600 79672 ?        S    Nov08   0:13 /usr/bin/php8.0 artisan horizon:work redis --name=default --supervisor=site-prod-w-2-2ubE:supervisor-1 --backoff=0 --max-time=0 --max-jobs=0 --memory=128 --queue=default --sleep=3 --timeout=300 --tries=3 --rest=0
forge    1246326  6.9  0.5 196980 44616 ?        S    Nov08  46:49 php-fpm: pool www
forge    1246330  6.9  0.5 196980 44464 ?        S    Nov08  46:50 php-fpm: pool www
forge    1255181  5.8  0.5 123212 43808 ?        S    Nov08  12:31 php-fpm: pool www
forge    1259266  0.0  0.0   8156  2576 pts/0    S+   00:36   0:00 grep --color=auto php

Staging

For our staging server (older DigitalOcean Ubuntu Droplet) I even seem to have PHP 7.2 running which is not installed according to Forge…

forge@site-staging:~/staging.site.com/current$ ps aux |grep php/7.2
root      9854  0.0  0.2 502220  4644 ?        Ss   Nov03   0:21 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
forge    12822  0.0  0.0  14860  1004 pts/0    S+   00:29   0:00 grep --color=auto php/7.2

PHP 7.4 is there too, but not by default.

forge@site-staging:~/staging.site.com/current$ ps aux |grep php/7.4
root      9652  0.0  0.3 505052  7916 ?        Ss   Nov03   0:21 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
forge    12833  0.0  0.1  14860  2644 pts/0    S+   00:29   0:00 grep --color=auto php/7.4

Solutions

Do I need to do:

sudo apt-get purge php7.*
sudo apt-get autoclean
sudo apt-get autoremove

bypassing the Forge Dashboard options as they do not work and get rid of PHP 7? Or should I kill the processes running? How can PHP 7.4 and 7.2 still be used if PHP 8 is the default?

0 likes
5 replies
rhand's avatar
Level 6

Did forget that Nginx was still using

fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

so changed it to

fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;

and reloaded Nginx. Testing now. But seems I still cannot remove PHP 7.4 via Forge .

Then I Changed scheduler to

php8.0 /home/forge/staging.site.com/current/artisan schedule:run

instead of

php /home/forge/staging.site.com/current/artisan schedule:run

but still no dice

rhand's avatar
Level 6

@jlrdw Under meta https://forge.laravel.com/servers/xxxxx/sites/xxxx#/meta I now all of the sudden did see that PHP 7.4 was stil selected for the site so switched to PHP 8.0 there as well. This was under the site section meta data, not under the server section. After that I was able to choose to uninstall it

Now checking how I can remove PHP 7.2 which is not installed according to Laravel Forge and I do not recall installing

forge@site-staging:~/staging.site.com/current$ ps aux |grep php/7.2
root      3502  0.0  1.5 502220 31940 ?        Ss   01:32   0:00 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
forge     4035  0.0  0.0  14860  1040 pts/0    S+   01:35   0:00 grep --color=auto php/7.2

Once I figured that out and all works I will do the other server as well.

Production server seems to be using only PHP 8.0 now that I changed the sites' PHP version as well after I changed the Nginx configurations to load PHP 8.0 FPM as well. Not sure if I need to change the schedulers. Still testing some.

rhand's avatar
Level 6

May need to use

sudo apt-get purge php7.2.*
sudo apt-get autoclean
sudo apt-get autoremove

to get rid of PHP 7.2

ps aux |grep php/7.2
root      3502  0.0  0.8 502220 18304 ?        Ss   01:32   0:00 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
..

as Laravel Forge mentions it has not been installed so presumably not done by Forge.. though I do not recall adding it myself.

rhand's avatar
rhand
OP
Best Answer
Level 6

Did it all to remove PHP 7.2 leftovers:

sudo apt-get purge php7.2.*
...
Package 'php7.2-vips' is not installed, so not removed
Package 'php7.2-xdebug' is not installed, so not removed
Package 'php7.2-xhprof' is not installed, so not removed
Package 'php7.2-xmlrpc' is not installed, so not removed
Package 'php7.2-xsl' is not installed, so not removed
Package 'php7.2-yac' is not installed, so not removed
Package 'php7.2-yaml' is not installed, so not removed
Package 'php7.2-zmq' is not installed, so not removed
Package 'php7.2-zstd' is not installed, so not removed
The following packages will be REMOVED:
  php7.2-bcmath* php7.2-cli* php7.2-common* php7.2-curl* php7.2-dev* php7.2-fpm* php7.2-gd* php7.2-igbinary* php7.2-imap* php7.2-intl* php7.2-json* php7.2-mbstring* php7.2-memcached* php7.2-msgpack* php7.2-mysql* php7.2-opcache*
  php7.2-pgsql* php7.2-readline* php7.2-redis* php7.2-soap* php7.2-sqlite3* php7.2-xml* php7.2-zip*
0 upgraded, 0 newly installed, 23 to remove and 45 not upgraded.
After this operation, 27.6 MB disk space will be freed.
(Reading database ... 123585 files and directories currently installed.)
Removing php7.2-bcmath (7.2.34-26+ubuntu18.04.1+deb.sury.org+1) ...
Removing php7.2-dev (7.2.34-26+ubuntu18.04.1+deb.sury.org+1) ...
Removing php7.2-fpm (7.2.34-26+ubuntu18.04.1+deb.sury.org+1) ...
Removing php7.2-cli (7.2.34-26+ubuntu18.04.1+deb.sury.org+1) ...
...
sudo apt-get autoclean
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Del php5.6-igbinary 3.2.6+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 [28.1 kB]
Del php7.2-igbinary 3.2.6+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 [68.1 kB]
Del php7.0-igbinary 3.2.6+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 [63.0 kB]
...
sudo apt-get autoclean
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Del php5.6-igbinary 3.2.6+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 [28.1 kB]
Del php7.2-igbinary 3.2.6+2.0.8-1+ubuntu18.04.1+deb.sury.org+1 [68.1 kB]
...

Afterwards it did get removed. Did a check:

forge@site-staging:~/staging.site.com/current$ ps aux |grep php/7.2
forge    25840  0.0  0.0  14860  1032 pts/0    S+   03:16   0:00 grep --color=auto php/7.2

so no rogue PHP 7.2 left anymore.

Please or to participate in this conversation.