PHP versions not changing

Discussion in 'General' started by Alecs, Jan 31, 2024.

  1. Alecs

    Alecs New Member

    Hello guys,

    I am using Ubuntu 20.04/6 LTS with ISPConfig. The default PHP version is PHP7.4 and I recently installed PHP 8.1, PHP, 8.2, PHP 8.3.
    I updated my website and deployed it to the server but I get 500 errors on specific links. I am running Laravel 10 so I want to have PHP8.2 at least.
    After configuring the Additional PHP Version settings for all the PH versions mentioned above I also made sure that the default version is PHP 7.4 by checking the
    Code:
    update-alternatives --config php
    update-alternatives --config php-cgi
    update-alternatives --config php-fpm.sock
    so then I am going to the website settings, i am changing the PHP version to PHP 8.2 and then I am going to test the website. Surprise: 500 Internal Server Error!
    I check the website log and I get something like this:
    Code:
    2024/01/31 21:22:07 [error] 19219#19219: *190 openat() "/var/www/xxx.yy/web/error/404.html" failed (2: No such file or directory), client: xxx.xxx.xxx.xxx, server: xxx.yy, request: "HEAD / HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.4-fpm/web1.sock", host: "www.xxx.yy"
    
    I am also checking the vhost and I have it like this:

    Code:
           location @php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/lib/php7.4-fpm/web1.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
            }
    I rebooted the server, changed the PHP versions for the website, installed another PHP version, like PHP 8.0 (maybe was something stuck), forced the ispconfig update ... nothing works.

    Any ideas, suggestions?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Disable custom error pages in website settings.

    That's fine and as it should be for any PHP version. The number 7.4 in the path is not the PHP version; this path does not and shall not change when you change the php version. You can not see in the vhost file which PHP version is used by that site.

    Double check that you configured the php versions as described here: https://www.howtoforge.com/ispconfig-php-ubuntu/
    e.g. the field socket directory of the PHP versions should be empty.

    Also custom apache or nginx directives can prevent PHP versions from being changed, do you use any and if yes, which exact directives do you use?
     
    ahrasis likes this.
  3. Alecs

    Alecs New Member

    actually the PHP version change is working. I had another issue with the code and this was throwing a 500. what helped was the disabling of the custom error pages! Thank you @till
     
    till likes this.

Share This Page