Site Admin
Site Admin Founder of MeaningArticles
65 Views

Enable Php In Apache

Hello Dev.

on this educational, i'm able to learn you how to use php code display in browser instead of executing it. you can smooth and actually use php code display in browser in place of executing it.

in case your php code is being displayed in the browser, it means that your server has no longer been setup to serve php scripts. here are a listing of factors which you want to check so that it will debug the difficulty.


Solution 1:

First run php -v from command line to know if it return PHP version or any errors to make sure PHP is installed properly or not in your system.

If you don't have PHP installed then install PHP first in this case...

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

If you have PHP installed but it is not enabled then enable by running following command...

sudo a2enmod php5  
sudo service apache2 restart

 If you have PHP installed and enabled both then restart your apache server by running following command...

sudo service apache2 restart


Solution 2:

It might be PHP is not enabled in your apache configuration.

You can uncomment PHP module by removing '#' sign at the beginning from httpd.conf file. Save file and then restart the web server.

i'm hoping it assist you to, thanks for visit my article if you like my article then proportion together with your friend and social platform.