How to Configure PHP Support in Apache HTTP Server
In this article, we'll address the issue of PHP files being rendered as plain text, despite having PHP and Apache installed on a system. To resolve this, we need to ensure that Apache is configured to recognize and execute PHP scripts.
The solution involves installing the PHP library for Apache. Here's how you can do it:
On Debian and Ubuntu Systems:
apt-get install libapache2-mod-php5
service apache2 restart
Once the PHP library is installed and Apache is restarted, PHP files should be executed and interpreted correctly when accessed through your localhost. You should now be able to see the output of your PHP scripts in the browser instead of plain text.
The above is the detailed content of Why Are My PHP Files Displaying as Plain Text in Apache?. For more information, please follow other related articles on the PHP Chinese website!