Reputation: 701
Initially the problem was PHP files on my server were displayed as plain text(the whole code was shown). So I found out by investigating that the MIME type has to be added to the /etc/mime.types
, so I did that and also restarted my server but that didn't help solve the issue so on further investigation, I found out from here that we needed php5 module enabled and on running the apachectl -M
, I couldn't find the php5 module listed. So I tried installing it and this was the outcome of it :
admin@vm:~$ sudo apt-get install php5
...
php5_invoke pdo: already enabled for apache2 SAPI
dpkg: error processing package libapache2-mod-php5 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
libapache2-mod-php5
E: Sub-process /usr/bin/dpkg returned an error code (1)
admin@vm:~$ sudo apt-get install libapache2-mod-php5
...
dpkg: error processing package libapache2-mod-php5 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
libapache2-mod-php5
E: Sub-process /usr/bin/dpkg returned an error code (1)
I also need to mention that I created 2 virtual hosts for the sites. I am not sure what is wrong. Could some one help me on this?
Upvotes: 3
Views: 9868
Reputation: 41
the package libapache2-mod-php5 comprise libphp5.so which locates at /usr/lib/apache2/modules, and php5.conf/php5.load which locate at /etc/apache2/mods-availables. thus you could get the three files, and copy to corresponding position. And, you should link, using ln -s, php5.conf/load to /etc/apache2/mods-enables, thus apached could find the configuration file and load the libphp5.so.
I got the same problem and resolve it
Upvotes: 0
Reputation: 701
This is not a proper solution but I re-installed Apache and it worked fine:
$ sudo apt-get purge apache2
$ sudo apt-get purge php5 libapache2-mod-php5
$ sudo apt-get purge autoremove
$ sudo apt-get install apache2 libapache2-mod-php5 php5
Upvotes: 6