PHP issue

Hello,

PHP work only on one virtual host

[~]# php -v PHP 5.4.18 (cli) (built: Aug 19 2013 14:10:14) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd. [~]# rpm -qa | grep php-. php-mysql-5.4.18-24.el6.art.x86_64 php-xmlrpc-5.4.18-24.el6.art.x86_64 php-devel-5.4.18-24.el6.art.x86_64 php-snmp-5.4.18-24.el6.art.x86_64 php-odbc-5.4.18-24.el6.art.x86_64 php-process-5.4.18-24.el6.art.x86_64 php-imap-5.4.18-24.el6.art.x86_64 php-common-5.4.18-24.el6.art.x86_64 php-pdo-5.4.18-24.el6.art.x86_64 php-cli-5.4.18-24.el6.art.x86_64 php-pear-1.9.4-12.el6.remi.1.noarch php-pgsql-5.4.18-24.el6.art.x86_64 php-xml-5.4.18-24.el6.art.x86_64 php-mcrypt-5.4.18-24.el6.art.x86_64 php-5.4.18-24.el6.art.x86_64 php-gd-5.4.18-24.el6.art.x86_64 wbm-php-pear-1.5-1.noarch php-mbstring-5.4.18-24.el6.art.x86_64 php-ioncube-loader-4.4.1-3.el6.art.x86_64
# # PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. # LoadModule php5_module modules/libphp5.so LoadModule php5_module modules/libphp5-zts.so

Cause the PHP interpreter to handle files with a .php extension.

<FilesMatch .php$>
SetHandler application/x-httpd-php

Allow php to handle Multiviews

AddType text/html .php

Add index.php to the list of files that will be served as directory

indexes.

DirectoryIndex index.php

Uncomment the following lines to allow PHP to pretty-print .phps

files as PHP source code:

#<FilesMatch .phps$>

SetHandler application/x-httpd-php-source

#

Apache specific PHP configuration options

those can be override in each configured vhost

php_value session.save_handler “files”
php_value session.save_path “/var/lib/php/session”

Howdy,

Yeah, it looks like there’s a third party repository enabled on your system there – and pulling in packages from there can cause unusual/unexpected things to happen :slight_smile:

What you’d want to do is edit the php.conf file you posted in your second comment above, and comment out this line:

SetHandler application/x-httpd-php

Then, restart Apache with this command:

/etc/init.d/httpd restart

That should fix up the issue you’re seeing… let us know if that does the trick though!

-Eric

Hello andreychek,

after i make this change, the only one virtual host was working now stop, and it’s works for other, 6 better than 1 hahahahahahaha

so i make this change

<Directory “/home/VH_DEF/public_html/”>
<FilesMatch .php$>
SetHandler application/x-httpd-php



and it’s work fine to me, but is this good solution ?

Howdy,

Well, you shouldn’t need that in order to get any website running… so something really unusual is going on :slight_smile:

However, the first thing to note is that if it’s working now, that’s fantastic :slight_smile:

But what issue are you seeing when it doesn’t work?

What shows up in the browser? And what do you see in the error logs in $HOME/logs/error_log?

Also, in Virtualmin, if you go into Server Configuration -> Website Options for that particular domain, what is the PHP Execution Mode set to?

The issues you’re seeing have come up enough that I decided to write up some documentation regarding it… that’s available here in case you’re interested, it’s titled “Why does PHP / ProFTPd no longer work after performing updates? (I’m using CentOS, and enabled third party repositories)”:

https://www.virtualmin.com/documentation/system/faq