• I have inherited a website that was on 6.0.5 and PHP 7.4 which I want to transfer to a multisite server using 6.3.1, PHP 8.2 and nginx. The destination server is Debian 12 (Bookworm) using PHP and modules from the Sury repo.

    My first try was to spin up a new temporary install with 6.0.5, do the relevant updates to 6.3.1, export and reimport. I didn’t realize at that point that PHP8.2 was not compatible with 6.0.5, so my colleague spun up a 6.0.5/PHP7.4/Apache instance where we were successful in doing all the updates. We exported and reimported on to the destination box and are having problems with the nginx/php-fpm combination.

    In my error log I am getting lines like:

    2023/10/03 03:06:35 [error] 108449#108449: *3 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: XX.XX.XX.XX, server: finquesbahiamar.cat, request: "GET /info.php HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.2-fpm.sock:", host: "finquesbahiamar.cat"

    and the browser is displaying “File not found”.

    The following is from the nginx config:

    upstream php-handler {
        # server 127.0.0.1:9000;
        server unix:/run/php/php8.2-fpm.sock;
        }

    And

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/run/php/php8.2-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }

    The permissions are correct as far as I can work out:

    root@edisford:~# ls -al /run/php/
    total 4
    drwxr-xr-x  2 www-data www-data 100 Oct  3 03:04 .
    drwxr-xr-x 24 root     root     800 Oct  3 03:04 ..
    -rw-r--r--  1 root     root       6 Oct  3 03:04 php8.2-fpm.pid
    srw-rw----  1 www-data www-data   0 Oct  3 03:04 php8.2-fpm.sock
    lrwxrwxrwx  1 root     root      30 Oct  2 23:19 php-fpm.sock -> /etc/alternatives/php-fpm.sock

    I am getting wooden splinters in my fingernails from scratching my head and guidance would be appreciated. Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘nginx/php-fpm “Primary script unknown”’ is closed to new replies.