[Newbie help] Access the URL of the /info.php file in the browser to download, not to display phpinfo information

In the Ubuntu Server 24.04 + php8.3-cli + php-fpm + nginx environment, after doing the following, access the URL of the /info.php file in the browser to download, not to display phpinfo information.

Oracle Cloud Free 1c1g VPS for Ubuntu Server 24.04

$ sudo apt install nginx
$ nginx -V
nginx version: nginx/1.24.0 (Ubuntu)
built with OpenSSL 3.0.13 30 Jan 2024
TLS SNI support enabled

$ sudo apt install php8.3-cli php-fpm

The following NEW packages will be installed:
  php-common php8.3-cli php8.3-common php8.3-opcache php8.3-readline psmisc php-fpm php8.3-fpm

$ php -v
PHP 8.3.6 (cli) (built: Jul 14 2025 18:30:55) (NTS)

sudo systemctl status php8.3-fpm is in the running state

/etc/php/8.3/fpm/pool.d/www.conf is unmodified by default, with the uncommented line :
listen = /run/php/php8.3-fpm.sock

sudo vim /etc/php/8.3/cli/php.ini
Just removed the annotation symbol for this line
extension_dir = "./"

sudo vim /etc/nginx/sites-enabled/default
Adjust the configuration after removing the comment to

location ~ \.php$ {
        include snippets/fastcgi-php.conf;
#
#       # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
#       # With php-cgi (or other tcp sockets):
#       fastcgi_pass 127.0.0.1:9000;
}

/info.php

<?php
phpinfo();
?>

Resolved, the nginx path order didn’t match this one.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.