PHP not working under Virtualmin on centOS - PHP code is output, not executed

6 posts / 0 new
Last post
#1 Wed, 07/27/2016 - 11:49
cron

PHP not working under Virtualmin on centOS - PHP code is output, not executed

I have a new Webmin box with 3 servers set up on it. I've tried everything I can find online but I just cannot get PHP to execute code. The PHP content itself is simply output to the browser. I've tried this on multiple domains and they are all the same result.

I didn't do anything unusual during installation, I just installed webmin, then php, proftpd, etc with yum & then virtualmin, so I'm sure it is just a config issue somewhere but I cannot find it!

I have: 1. Uncommented the line: LoadModule php5_module modules/libphp5.so in httpd.conf 2. Checked /etc/httpd/conf.d for any setHandler lines

Any help or advice would be much appreciated.

Wed, 07/27/2016 - 11:59
andreychek

Howdy,

What is the output of these commands:

ls /etc/yum.repos.d
rpm -qa | grep php

Also, which distro/version is it that you're using there?

-Eric

Wed, 07/27/2016 - 12:49
cron

Thanks for the reply!

ls /etc/yum.repos.d:

CentOS-Base.repo       epel-testing.repo
CentOS-CR.repo         rhscl-php54-epel-6-x86_64.repo
CentOS-Debuginfo.repo  rhscl-php55-epel-7-x86_64.repo
CentOS-fasttrack.repo  rhscl-rh-php56-epel-7-x86_64.repo
CentOS-Media.repo      webtatic-archive.repo
CentOS-Sources.repo    webtatic.repo
CentOS-Vault.repo      webtatic-testing.repo

rpm -qa | grep php:

php55-php-xml-5.5.21-4.el7.centos.x86_64
php55-php-pecl-jsonc-1.3.5-1.el7.centos.x86_64
rh-php56-php-pecl-jsonc-1.3.6-3.el7.centos.x86_64
rh-php56-php-process-5.6.5-7.el7.centos.x86_64
php55w-5.5.38-1.w7.x86_64
php55-php-cli-5.5.21-4.el7.centos.x86_64
php55-php-common-5.5.21-4.el7.centos.x86_64
php55-2.0-1.el7.centos.x86_64
rh-php56-php-common-5.6.5-7.el7.centos.x86_64
rh-php56-php-pdo-5.6.5-7.el7.centos.x86_64
rh-php56-php-mysqlnd-5.6.5-7.el7.centos.x86_64
rhscl-php54-epel-6-x86_64-1-2.noarch
php55w-cli-5.5.38-1.w7.x86_64
rhscl-php55-epel-7-x86_64-1-2.noarch
php55-runtime-2.0-1.el7.centos.x86_64
php55-php-pear-1.9.4-10.el7.centos.noarch
php55-php-mysqlnd-5.5.21-4.el7.centos.x86_64
rh-php56-runtime-2.0-6.el7.centos.x86_64
rh-php56-php-xml-5.6.5-7.el7.centos.x86_64
rh-php56-2.0-6.el7.centos.x86_64
php55w-common-5.5.38-1.w7.x86_64
php55-php-process-5.5.21-4.el7.centos.x86_64
php55-php-pdo-5.5.21-4.el7.centos.x86_64
rhscl-rh-php56-epel-7-x86_64-1-2.noarch
rh-php56-php-cli-5.6.5-7.el7.centos.x86_64
rh-php56-php-pear-1.9.5-3.el7.centos.noarch
php55w-opcache-5.5.38-1.w7.x86_64

cat /etc/redhat-release:

CentOS Linux release 7.2.1511 (Core)
Thu, 07/28/2016 - 00:09
andreychek

Howdy,

Yeah it looks like you have some non-standard PHP versions installed there.

Most likely one of them came with a config file that's causing the problems you're seeing now.

The key would be to find the PHP config files associated with those third party PHP versions, and then determine what about those configs are causing the issue you're seeing. Chances are that it's related to a SetHandler line, but it could also be something else.

-Eric

Thu, 07/28/2016 - 08:12
Diabolico
Diabolico's picture

It could be many things, a lot of repos there and i can bet all of them enabled what should never happen, then OP installed separately Webmin, LAMP... Virtualmin what is another mistake as Webmin/Virtualmin should be installed on clean OS.

@cron: I would scrap that server and make fresh OS and Virtualmin install. Once done you can install additional PHP versions. Keep additional repos always disabled and enable only to update specific software but you must know what, e.g. installing and updating fail2ban from EPEL is ok but if you update ClamAV it will break it, and so on.

For the repos EPEL is pretty safe to use if you know how to use it and for what and SCL if you want additional software like PHP 5.5 or 5.6 (7 still not supported). For other repos is hit or miss if you dont know what are you doing and even then its always a risk to use them. Usually they work fine but one mistake could crash your entire server.

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Thu, 07/28/2016 - 10:02
cron

Thanks Eric, I couldnt find anything so I ended up removing all repositories and installing new ones, then reinstalling apache,php,ssl and it worked! Glad to have it sorted at last.

Topic locked