📋
Install Nginx, MariaDB, PHP & phpMyAdmin
  • Get Started
  • Install Nginx
  • *Install MariaDB
  • Install MySQL
  • Install PHP
  • Configure Nginx for PHP
  • Test PHP
  • Install phpMyAdmin
  • Update root Password
  • Reference
Powered by GitBook
On this page

Was this helpful?

Test PHP

PreviousConfigure Nginx for PHPNextInstall phpMyAdmin

Last updated 1 year ago

Was this helpful?

To see if PHP is working correctly on Ubuntu 20.04, create a new PHP file called info.php in the document root directory. By default, this is located in /var/www/html/, or if you set up multiple domains in a previous guide, it may be located in somewhere like /var/www/mytest1.com/public_html

Once you have the correct document root directory, use the nano text editor to create a new file info.php

sudo nano /var/www/html/info.php

Type or paste the following code into the new file.

In file: /var/www/html/info.php
<?php
    phpinfo();
?>

Press CTRL + X, press Y and then press ENTER to save and exit.

You can now view this page in your web browser by visiting your server’s domain name or public IP address followed by /info.php: http://your_domain_or_IP/info.php

You have now successfully installed PHP-FPM for Nginx on Ubuntu 20.04.

Make sure to delete info.php as it contains information about the web server that could be useful to attackers.

sudo rm /var/www/html/info.php

As per this article write on February 4, 2024 we unable to access the info.php with response code 502 Bad Request.