Hi I have a site that I changed the php ver, but somehow it is not working. no matter what php ver I picked, it always shows the default ver 8.1 I used to work. How to troubleshoot this issue? thanks,
Where does it show that? The only way to reliably test this is to add a php file with phpinfo(); command inside into a website. You can e.g. not see the PHP version in the website vhost file.
if you're logging in as an ssh user and expecting to see the cli using the same php version as the website's set to, it doesn't work like that.. the cli always uses the system default php. you can use the full path eg /usr/bin/php8.3 to specify a different version.. any additional php versions also need to be included in your jailkit if used. if you're using a websites own ssh user login and want to use just the command 'php' to use eg /usr/bin/php8.3 then set it as an alias in that users ~/.bashrc file
Yes, That's exactly how I tested. But somehow it always shows ver 8.1 I don't know how to troubleshoot.
Check the apache or nginx sites-available directory to see if the vhost file of that site has a .err file ending. Also, did you do this change as admin user in ISPConfig? If not, it might be that the client protection is on which limits such changes by the client and allows the admin user only to change the PHP version.
I found out the reason. there is such code in the vhost file setting the php ver to 8.1, after changing the ver number in codes, it works now. thanks. location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; # Adjust the PHP version if necessary fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
This reases all kinds of questions What OS and which ISPC version are you running? Default PHP config in vhost file on Ubuntu is: Code: location ~ \.php$ { try_files /<random>.htm @php; } location @php { try_files $uri @redirect; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php/<web id>.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } which makes PHP run the version you have set in ISPC panel and runs as website user.
Above config was taken from Ubuntu 24.04.1 LTS. Your version shouldn't be much different. Did you set your PHP vhost config as Nginx directive in the Options tab of your website on your ISPC panel? Then above config gets overwritten in the vhost file. Otherwise I can't explain your completely different config.
That's not from ISPConfig. So it seems you manually inserted that code, which of course, must disable PHP version changing via ISPConfig
He didn't figure it out yet. The given code isn't default ISPC code. Somewhere that gets overwritten by the given faulty code, probably where I mentioned. And besides that, when you're using ISPC you should NEVER manually alter vhost config files. The next time somehing about the website is changed in the ISPC panel then the vhost config file is rewritten, putting the faulty code back in place.