PHP 5.5 mod_php + PHP 5.3 suPHP

Hunterok

Verified User
Joined
Jul 2, 2013
Messages
15
I've built PHP 5.5 mod_php + PHP 5.3 suPHP. Then changed php1=5.3 and php2=5.5 values in the "PHP Version Selector" for the user's domain. But php_info() still shows 5.5 version. How can I fix it?
 
Then changed php1=5.3 and php2=5.5 values in the "PHP Version Selector" for the user's domain. But php_info() still shows 5.5 version. How can I fix it?


Run this:

Code:
./build update
./build php d
./build rewrite_confs

and restart apache.
 
Try then to rewrite all users configs:

Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d

and restart apache.

I assume you check phpinfo() output in a browser, not in a shell. Is that so?
 
Then changed php1=5.3 and php2=5.5 values in the "PHP Version Selector" for the user's domain.

It seems I've misunderstood your message. Did you change it in Directadmin (in a browser) or in a shell in options.conf?

I guess you mean this feature http://directadmin.com/features.php?id=1456 Right?

Not too sure, but please check /usr/local/directadmin/data/templates/custom/ you probably have there outdated virtual_hosts*.conf templates, if so you might need to update them.
 
zEitEr
Before the building I changed it in options.conf and then in Directadmin in a browser.
This folder /usr/local/directadmin/data/templates/custom/ is empty. What should I do with it? I've seen some templates which users posted on the forum but it is better to see some guide.
 
No need to do anything to /usr/local/directadmin/data/templates/custom/, as you are using the actual defaults in this case.

Just a guess, make sure you've got /usr/lib/apache/libphp5.so with date modified when you rebuilt PHP. If the date differs then you probably have an error with building the lib.
 
But there is no problem with PHP5, the problem is that PHP doesn't switch for the domain. And the date is correct.
 
Will you please post here the content of httpd.conf for the affected virtual host.

p.s. And of course you've got the latest Directadmin version, right? And aren't using CloudLinux?
 
Yes, I have latest DA version and no Cloudlinux.

Code:
# Auto generated apache config file by DirectAdmin version 1.43.3
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to his/her website

# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=2
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3


<Directory "/home/myhost">
	
	<IfModule mod_suphp.c>
		suPHP_Engine ON
		suPHP_UserGroup myhost myhost
		SetEnv PHP_INI_SCAN_DIR /usr/local/directadmin/data/users/myhost/php/
	</IfModule>
	
	
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid myhost myhost
		RGroups apache access
	</IfModule>
	
	
	
	
	
</Directory>




<VirtualHost 95.47.140.211:80 >


	ServerName www.myhost.com
	ServerAlias www.myhost.com myhost.com 
	ServerAdmin [email protected]
	DocumentRoot /home/myhost/domains/myhost.com/public_html
	ScriptAlias /cgi-bin/ /home/myhost/domains/myhost.com/public_html/cgi-bin/

	UseCanonicalName OFF

	<IfModule !mod_ruid2.c>
		SuexecUserGroup myhost myhost
	</IfModule>
	
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid myhost myhost
		RGroups apache access
	</IfModule>
	
	CustomLog /var/log/httpd/domains/myhost.com.bytes bytes
	CustomLog /var/log/httpd/domains/myhost.com.log combined
	ErrorLog /var/log/httpd/domains/myhost.com.error.log

	

	<Directory /home/myhost/domains/myhost.com/public_html>








		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'


		php_admin_value open_basedir /home/myhost/:/tmp:/var/tmp:/usr/local/lib/php/


		suPHP_Engine ON
		suPHP_UserGroup myhost myhost

	</Directory>





</VirtualHost>





<VirtualHost 95.47.140.211:443 >

		SSLEngine on
		SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
		SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
		

		ServerName www.myhost.com
		ServerAlias www.myhost.com myhost.com 
		ServerAdmin [email protected]
		DocumentRoot /home/myhost/domains/myhost.com/private_html
		ScriptAlias /cgi-bin/ /home/myhost/domains/myhost.com/public_html/cgi-bin/

		UseCanonicalName OFF

		<IfModule !mod_ruid2.c>
			SuexecUserGroup myhost myhost
		</IfModule>
		
		<IfModule mod_ruid2.c>
			RMode config
			RUidGid myhost myhost
			RGroups apache access
		</IfModule>
		

		CustomLog /var/log/httpd/domains/myhost.com.bytes bytes
		CustomLog /var/log/httpd/domains/myhost.com.log combined
		ErrorLog /var/log/httpd/domains/myhost.com.error.log

		

	<Directory /home/myhost/domains/myhost.com/private_html>







		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'


		php_admin_value open_basedir /home/myhost/:/tmp:/var/tmp:/usr/local/lib/php/


		suPHP_Engine ON
		suPHP_UserGroup myhost myhost

	</Directory>





</VirtualHost>
 
Same Problem

I had exactly the same problem

This is my custom httpd config file
Code:
# Auto generated apache config file by DirectAdmin version 1.43.3
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to his/her website

# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=2
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3


<Directory "/home/mydomain">
	
	<IfModule mod_suphp.c>
		suPHP_Engine ON
		suPHP_UserGroup mydomain mydomain
		SetEnv PHP_INI_SCAN_DIR /usr/local/directadmin/data/users/mydomain/php/
	</IfModule>
	
	
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid mydomain mydomain
		RGroups apache access
	</IfModule>
	
</Directory>




<VirtualHost 12.34.567.89:80 >


	ServerName www.mydomain.com
	ServerAlias www.mydomain.com mydomain.com 
	ServerAdmin [email protected]
	DocumentRoot /home/mydomain/domains/mydomain.com/public_html
	ScriptAlias /cgi-bin/ /home/mydomain/domains/mydomain.com/public_html/cgi-bin/

	UseCanonicalName OFF

	<IfModule !mod_ruid2.c>
		SuexecUserGroup mydomain mydomain
	</IfModule>
	
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid mydomain mydomain
		RGroups apache access
	</IfModule>
	
	CustomLog /var/log/httpd/domains/mydomain.com.bytes bytes
	CustomLog /var/log/httpd/domains/mydomain.com.log combined
	ErrorLog /var/log/httpd/domains/mydomain.com.error.log

	

	<Directory /home/mydomain/domains/mydomain.com/public_html>


		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'


		php_admin_value open_basedir /home/mydomain/:/tmp:/var/tmp:/usr/local/lib/php/


		suPHP_Engine ON
		suPHP_UserGroup mydomain mydomain

	</Directory>


</VirtualHost>



<VirtualHost 12.34.567.89:443 >

		SSLEngine on
		SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
		SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
		

		ServerName www.mydomain.com
		ServerAlias www.mydomain.com mydomain.com 
		ServerAdmin [email protected]
		DocumentRoot /home/mydomain/domains/mydomain.com/private_html
		ScriptAlias /cgi-bin/ /home/mydomain/domains/mydomain.com/public_html/cgi-bin/

		UseCanonicalName OFF

		<IfModule !mod_ruid2.c>
			SuexecUserGroup mydomain mydomain
		</IfModule>
		
		<IfModule mod_ruid2.c>
			RMode config
			RUidGid mydomain mydomain
			RGroups apache access
		</IfModule>
		

		CustomLog /var/log/httpd/domains/mydomain.com.bytes bytes
		CustomLog /var/log/httpd/domains/mydomain.com.log combined
		ErrorLog /var/log/httpd/domains/mydomain.com.error.log

		

	<Directory /home/mydomain/domains/mydomain.com/private_html>


		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'


		php_admin_value open_basedir /home/mydomain/:/tmp:/var/tmp:/usr/local/lib/php/


		suPHP_Engine ON
		suPHP_UserGroup mydomain mydomain
	</Directory>
</VirtualHost>

this is my custombuild options.conf
Code:
#PHP settings.
#Default version of PHP is always php1_release. Possible values for php1/php2_release: 5.3, 5.4, 5.5, no. php1/php2_mode: mod_php, fastcgi, php-fpm or suphp)
php1_release=5.5
php2_release=5.3
php1_mode=mod_php
php2_mode=suphp
php_ini=yes
php_timezone=CEST
#Possible values - production or development
php_ini_type=production
ioncube=yes
zend=no

#HTTP server. Possible values: apache, nginx
webserver=apache

#Apache settings
#Possible value: 2.4
apache_ver=2.4
mod_ruid2=yes
secure_htaccess=no
harden-symlinks-patch=yes
use_hostname_for_alias=no
redirect_host=da.mydomain.com
redirect_host_https=no

#Possible values - 5.1, 5.5, 5.6
mysql=5.6
mysql_inst=yes
mysql_backup=yes
mysql_backup_dir=/usr/local/directadmin/custombuild/mysql_backups

#Web applications
phpmyadmin=yes
phpmyadmin_ver=4
squirrelmail=yes
roundcube=yes

#Mail options
exim=no
eximconf=no
clamav=no
spamassassin=no
dovecot=yes
pigeonhole=no

#Statistics
awstats=no
webalizer=yes

#FTP options - possible values: proftpd, pureftpd
ftpd=pureftpd

#Jailed shell
jail=no

#Autoconf/automake/libtool options
autoconf=yes
automake=yes
libtool=yes
curl=no

#new version of zlib and libxml2 (experts only)
zlib=no
new_zlib=no
new_xml2=yes
new_pcre=no

#Custombuild options
custombuild=2.0
autover=no
bold=yes
clean=yes
cleanapache=no
clean_old_tarballs=yes
clean_old_webapps=yes
downloadserver=files6.directadmin.com

#Cron settings
cron=no
cron_frequency=daily
[email protected]
notifications=yes
da_autoupdate=no
updates=no
webapps_updates=yes

#Cloudlinux settings
cloudlinux=no
cagefs=no
old_apr_util=no

Maybe can someone who have the switch working correcty also post these files here so we can check the difference between what cause the problem.

Sorry for my bad english
 
I got this problem today on a new servers... Unable to set custom php version per domain...

I use php 5.4 suphp and 5.3 suphp with the lasted DA and custombuild version.

Regards,
 
Hello,

I can't seem to duplicate that..
I'm using these values in my options.conf:
Code:
php1_release=5.3
php1_mode=suphp
php2_release=5.4
php2_mode=suphp
mod_ruid2=no
ran a full:
Code:
./build update
./build apache
./build php n
./build suphp
./build rewrite_confs
and after the php selector swap, the User httpd.conf that I ended up with looks like this:
Code:
<VirtualHost 192.168.1.228:80 >
        ServerName www.es7-test.com
        ServerAlias www.es7-test.com es7-test.com
        ServerAdmin [email protected]
        DocumentRoot /home/admin/domains/es7-test.com/public_html
        ScriptAlias /cgi-bin/ /home/admin/domains/es7-test.com/public_html/cgi-bin/
        UseCanonicalName OFF
        <IfModule !mod_ruid2.c>
                SuexecUserGroup admin admin
        </IfModule>
        CustomLog /var/log/httpd/domains/es7-test.com.bytes bytes
        CustomLog /var/log/httpd/domains/es7-test.com.log combined
        ErrorLog /var/log/httpd/domains/es7-test.com.error.log
        <Directory /home/admin/domains/es7-test.com/public_html>
                suPHP_Engine ON
                suPHP_UserGroup admin admin
                <FilesMatch "\.php$">
                        AddHandler x-httpd-php54 .php
                </FilesMatch>
                <FilesMatch \.php53$>
                        AddHandler x-httpd-php53 .php53
                </FilesMatch>
        </Directory>
</VirtualHost>
Using the hosts file, I was able to confirm that swapping the first php to 5.4 and 2nd to 5.3, worked..
I used several files:
info.php
info.php53
info.php54

The info.php varied depending on the first php selector, and the other 2 remained the same.

Check your User httpd.conf file, to see if yours looks anything like that.

John
 
Hi John,

well, I just got it to work... Seems that this part was missing in the virtualhost

<FilesMatch "\.php$">
AddHandler x-httpd-php54 .php
</FilesMatch>
<FilesMatch \.php53$>
AddHandler x-httpd-php53 .php53
</FilesMatch>

So I removed my custom virtual_host2*.conf and ./build rewrite_confs and it seems to work... I re-installed my custom virtual_host2*.conf and ./build rewrite_confs again and seems to still working... I don't know why it didn't work the first time correctly....

Thank you.

Regards,
 
Back
Top