0

I've encountered this problem before and been able to resolve it, but that is not the case now.

I followed some instructions to upgrade PHP 5.3 to PHP 5.6 and now PHP files simply show the source in the browser.

I've added the following lines to httpd.conf

AddHandler php5-script .php
AddType application/x-httpd-php .php

But this doesn't fix the issue. Some other advice I've read is to use LoadModule php5_module modules/libphp5.so however there is no libphp5.so file on my system, and I've read elsewhere that this advice is not right anyway

What else can I try?

The answers at PHP code is not being executed, instead code shows on the page don't appear to apply, for example as I've mentioned libphp5.so doesn't exist anymore

Community
  • 1
  • 1
braks
  • 1,505
  • 15
  • 23
  • 1
    Yes I've read that one already – braks Apr 05 '16 at 08:28
  • Start by taking a look into your http servers error log file when it starts up. Anything of interest there about loading php? – arkascha Apr 05 '16 at 08:31
  • 1
    Check if `apachectl -t -D DUMP_MODULES` lists `php5_module` as one of the loaded modules – apokryfos Apr 05 '16 at 08:34
  • What is the extension of your PHP files? Do you have that extension allowed in the config? – Legionar Apr 05 '16 at 08:37
  • arkascha: No not in the error logs but if I do php -v I see errors like "PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/pdo.so' - /usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0" but I think those has been there all along. apokryfos No I don't see it. Legionar .php and isn't that what the AddHandler and AddType lines do ? – braks Apr 05 '16 at 08:39
  • of course `.php`, but you can also use f.e. `.phtml` or whatever else. – Legionar Apr 05 '16 at 09:03
  • how was php installed? – Muihlinn Apr 05 '16 at 09:12
  • I used this to upgrade from 5.3 to 5.6 http://superuser.com/questions/615401/upgrading-php-5-3-3-to-5-4-4-in-centos-6-4 and I've also done yum remove php-cli and yum install php-cli since posting this question - no change. – braks Apr 05 '16 at 10:39

1 Answers1

0

I solved it with

yum remove php php-common

then reconfiguring remi.repo according to the answer at:

PHP installation conflicts on Centos6

I didn't actually have a remi.repo so I used

cd /etc/yum.repos.d
wget http://rpms.remirepo.net/fedora/remi.repo

and then yum install php php-common

and restarted httpd.

what a headache

Community
  • 1
  • 1
braks
  • 1,505
  • 15
  • 23