3

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?

2 Answers 2

6

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 
Sign up to request clarification or add additional context in comments.

2 Comments

$ sudo apt-get purge autoremove Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package autoremove
autoremove should not have "purge"
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.