I just upgraded php on my Ubuntu Server 12.04 to 5.4 from 5.3, using the ppa:ondrej/php5-oldstable
ppa but now my php-powered sites don't load (I just get a downloaded file). I've restarted apache2
, and my /etc/apache2/mods-available/php5.conf
file looks like this:
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
# AddType application/x-httpd-php-source .phps
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
# php_admin_value engine Off
</Directory>
</IfModule>
There's nothing in apache's error.log:
[Tue Feb 10 15:55:13 2015] [notice] caught SIGTERM, shutting down
[Tue Feb 10 15:55:14 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Tue Feb 10 15:55:14 2015] [notice] Digest: generating secret for digest authentication ...
[Tue Feb 10 15:55:14 2015] [notice] Digest: done
[Tue Feb 10 15:55:14 2015] [notice] Apache/2.2.22 (Ubuntu) DAV/2 SVN/1.6.17 mod_fcgid/2.3.6 PHP/5.4.37-1+deb.sury.org~precise+1 mod_ruby/1.2.6 Ruby/1.8.7(2011-06-30) mod_ssl/2.2.22 OpenSSL/1.0.1 configured -- resuming normal operations
apache2ctl configtest
gives this output:
[Tue Feb 10 16:23:42 2015] [warn] The Alias directive in /etc/apache2/conf.d/owncloud.conf.old at line 1 will probably never match because it overlaps an earlier Alias.
[Tue Feb 10 16:23:42 2015] [warn] NameVirtualHost 2001:41D0:2:6D94::1:443 has no VirtualHosts
[Tue Feb 10 16:23:42 2015] [warn] NameVirtualHost 94.23.234.148:443 has no VirtualHosts
I've also ensured the php5 mod is enabled with a2endmod php
(it says it's already enabled). Obviously there was some sort of configuration change between 5.3 and 5.4 but I can't find what it was using Google-fu.
Weirdly, OwnCloud works, which is why I upgraded to 5.4 in the first place (v8 requires it). It's build in PHP and executes fine!
If I put a php file in /var/www
it works, so the problem is obviously with my virtual hosts.
Any help much appreciated!
Laurence
I fixed this by disabling the
php5_cgi
Apache module, as per this thread over on Virtualmin's forums: https://www.virtualmin.com/node/25521