-1

Long story short, my PHP files show as text in browsers rather than running the PHP script. I am aware that there are questions similar to this but none answer my question. I'm lost.

I have an Apache web server with a Linux OS (Debian). I have installed apache2, php5, libapache2-mod-php5 and php5-common. After every configuration change I've made, I have restarted the Apache web server and there is no difference.

I'm not too sure which configuration files I need to show for you guys to help answer my question. I will edit this question to include the relevant information.

To clarify, my question is: Why do my PHP files show as text in browsers?

P.S. Everything used to work until I completely removed Apache and reinstalled it. Now it's broken.

4
  • Someone could likely ask for your PHP.ini file. Is there any source you can show us? Jul 16, 2015 at 23:52
  • Or may be you did mod-php is not loaded Jul 16, 2015 at 23:53
  • Was gonna say, check apache config file for the PHP extension. Jul 16, 2015 at 23:54
  • 1
    The php.ini file is large in terms of length and content. Are there any specific sections that are relevant? Jul 16, 2015 at 23:58

1 Answer 1

1

as the root user:

/usr/sbin/a2enmod php5
/etc/init.d/apache2 restart
5
  • When running /usr/sbin/a2enmod php5, I get the error, ERROR: Module php5 does not exist!. I have already run apt-get install php5 though? Jul 17, 2015 at 0:06
  • 1
    You need php5 and also libapache2-mod-php5, run apt-get install libapache2-mod-php5 Jul 17, 2015 at 0:08
  • When I run, apt-get install php5 and apt-get install libapache2-mod-php5 I get in return, php5 is already the newest version. and libapache2-mod-php5 is already the newest version. respectively. Jul 17, 2015 at 0:17
  • please be sure that the /etc/apache2/mods-available/php5.conf file exists, and paste its content Jul 17, 2015 at 0:22
  • Thank you for your help. I found a solution online at digitizor.com/2012/09/03/… Thank you :) Jul 17, 2015 at 0:25

Not the answer you're looking for? Browse other questions tagged .