Yes you can do this with apache/httpd as well. But for this tutorial I am using nginx.
For Redhat/Fedora/Rocky
For Debina/Ubuntu/Mint
For Arch/EndeavorOS
Arch does not have a separate php-pdo package. Find your /etc/php/php.ini file and uncomment this line.
Next we will enable and start nginx
If you want to see your web pages on other computers on your network you'll need to open the firewall.
For Redhat/Fedora/Rocky
For Debian/Ubuntu/Mint
OK, now you have an nginx web server running. By default nginx usually puts it's html pages in /usr/share/nginx/html.If your distro is different let me know, I didn't test them all. We will create a new text file here with your text editor.name it phpinfo.php It's important that it ends with the .php filename extension, or else it will not work. This file is short and easy, it should look like this.
Now open your web browser to http://10.0.0.67/phpinfo.php
Just change the IP address to the IP address of your web server. If all goes according to plan, you should see a web page hundreds of lines long. If all that works, congratulations, you have a web server running php.
... but that's not very exciting, at least not yet.
...to be continued.
For Redhat/Fedora/Rocky
Code:
sudo dnf install -y nginx nginx-all-modules nginx-filesystem nginx-mod-fancyindex php php-cli php-fpm php-gd php-gmp php-pgsql php-pdo
For Debina/Ubuntu/Mint
Code:
sudo apt update sudo apt install -y nginx nginx-extras php php-cli php-fpm php-gd php-gmp php-pgsql php-pdo
For Arch/EndeavorOS
Code:
sudo pacman -Syu sudo pacman -S nginx php php-fpm php-gd php-gmp php-pgsql
Arch does not have a separate php-pdo package. Find your /etc/php/php.ini file and uncomment this line.
Code:
extension=pdo
Next we will enable and start nginx
Code:
sudo systemctl enable nginx
sudo systemctl start nginx
If you want to see your web pages on other computers on your network you'll need to open the firewall.
For Redhat/Fedora/Rocky
Code:
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload
For Debian/Ubuntu/Mint
Code:
sudo ufw allow http
sudo ufw allow https
sudo ufw reload
OK, now you have an nginx web server running. By default nginx usually puts it's html pages in /usr/share/nginx/html.If your distro is different let me know, I didn't test them all. We will create a new text file here with your text editor.name it phpinfo.php It's important that it ends with the .php filename extension, or else it will not work. This file is short and easy, it should look like this.
Code:
<?php
phpinfo();
?>
Now open your web browser to http://10.0.0.67/phpinfo.php
Just change the IP address to the IP address of your web server. If all goes according to plan, you should see a web page hundreds of lines long. If all that works, congratulations, you have a web server running php.
... but that's not very exciting, at least not yet.
...to be continued.