I know this is probably most discussed topic online, I did search here and stackexchange and tried various answers but none of them seems to be working for me, hence why I am posting this.
I have a Debian with LAMP stack and recently had to upgrade php from 5.4 to 5.6 (latest).
I began by removing the old version like this:
a2dismod php5
sudo apt-get --remove --purge libapache2-mod-php5filter libapache2-mod-php5 libphp5-embed php-pear php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-mcrypt php5-mysql
Added the following to my /etc/apt/sources.list
file:
deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
deb http://packages.dotdeb.org wheezy-php56-zts all
deb-src http://packages.dotdeb.org wheezy-php56-zts all
And ran the following commands:
wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libapache2-mod-php5 php-pear php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-mcrypt php5-mysql php5-mysqlnd
Then I enabled php5 with this command a2enmod php5
and restarted apache2 with this command service apache2 restart
When I go to one of the PHP scripts on the site, I am seeing the source, the script is not getting executed.
On the server, I can see that PHP5.6 is correctly installed:
root@server:~# php -v
PHP 5.6.18-1~dotdeb+zts+7.1 (cli) (built: Feb 6 2016 23:39:42)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
And I can see that PHP5 module is enabled in apache2:
Here are the contents of these files:
I even tried restarting the whole server, it does not help. I've checked /var/log/apache2/error.log
and I do not see any errors. All I see is:
[Tue Feb 09 12:52:09 2016] [notice] Digest: generating secret for digest authentication ...
[Tue Feb 09 12:52:09 2016] [notice] Digest: done
[Tue Feb 09 12:52:09 2016] [notice] Apache/2.2.22 (Debian) mod_ssl/2.2.22 OpenSSL/1.0.1e configured -- resuming normal operations
I use VirtualHost in apache2 to serve the site. This is is my entry:
<VirtualHost *:80>
ServerAdmin support@mydomain.com
ServerName www.mydomain.com
DocumentRoot /home/setup/public_html
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/setup/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Any idea why the PHP script is not getting executed? What I have missed? Any help would be greatly appreciated.