Install PHP on CentOS 8

Step 1 : Install php

We start by installing PHP and some PHP modules:

sudo yum install php php-mysqlnd php-pdo php-gd php-mbstring php-json

Step 2 : Verify the PHP installation

php -v

Step 3 : Configure

We can edit /etc/php/php.ini to configure where to put error messages, the maximum size to upload a file to the website (very useful for dynamic websites that handle files), and so on.

sudo nano /etc/php/php.ini

Step 4 : we restart Apache

sudo systemctl restart httpd

Step 5 : Test your PHP

echo "<?php phpinfo() ?>" > /var/www/devtutorial1.local/home/info.php

Step 6 : Go to the client web browser and we type the domain/info.php in the address bar

Add Comment