PHP-FPM / fastcgi / second php instance not working

Ronnie

Verified User
Joined
Oct 11, 2007
Messages
10
I'm on Centos 6.8 and just upgraded from custombuild 1.2 to custombuild 2.

I wanted to start using php-fpm. The problem is, the code does not get executed.
Instead of compiling the php code, the php code is showed in the webbrowser.

As for the moment i've php1_mode set to mod_php, that is working.
php2_mode is set to php-fpm.

I selected the second php version for my test site, but it's using the php1 version.

It's driving me crazy for some days now.

Is there anyone here with some sugestions?
 
Try the following in .htaccess file and see if it works:

Code:
<IfModule mod_fastcgi.c>
        <FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php53|php54|php55|php56|phtml|phps)$">
                SetHandler php56-fcgi
        </FilesMatch>
</IfModule>

You may need to replace 56 with whatever version your php2 is.

To me it looks like that the second php binary is missing or something like that. You should probably recompile php with:

Code:
cd /usr/local/directadmin/custombuild
./build update
./build php n

and then look if the second php compilation is not failing with an error.

P.S. I would highly recommend to you to not use mod_php at all. It's a very unsecure option for shared hosting.
 
Last edited:
I have to use mod_php until i get php-fpm working without problems.

The second PHP instance is working. If i add the following to the .htaccess file, it's working like a charm.

Code:
        <FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php53|php54|php55|php56|phtml|phps)$">
        	AddHandler "proxy:unix:/usr/local/php56/sockets/ronnietest.sock|fcgi://localhost" .inc .php .phtml .php56
        </FilesMatch>

So i think something is wrong with the configration of apache.

Hereby the content of /usr/local/directadmin/data/users/ronnietest/httpd.conf

Code:
<Directory "/home/ronnietest/public_html">
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid ronnietest ronnietest
		#RGroups apache access
		RGroups @none
	</IfModule>
		<FilesMatch "\.(inc|php|phtml|phps|php56)$">
			AddHandler "proxy:unix:/usr/local/php56/sockets/ronnietest.sock|fcgi://localhost" .inc .php .phtml .php56
		</FilesMatch> 
	<IfModule mod_fcgid.c>
		SuexecUserGroup ronnietest ronnietest
	</IfModule>
		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'
		php_admin_value mail.log /home/ronnietest/.php/php-mail.log
		php_admin_value open_basedir /home/ronnietest/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php56/lib/php/:/usr/local/php53/lib/php/
</Directory>

<VirtualHost 77.74.49.156:80 >
	ServerName www.ronnietest.server.nl
	ServerAlias www.ronnietest.server.nl ronnietest.server.nl 
	ServerAdmin [email protected]
	DocumentRoot /home/ronnietest/domains/ronnietest.server.nl/public_html
	ScriptAlias /cgi-bin/ /home/ronnietest/domains/ronnietest.server.nl/public_html/cgi-bin/
	UseCanonicalName OFF
	SuexecUserGroup ronnietest ronnietest
	CustomLog /var/log/httpd/domains/ronnietest.server.nl.bytes bytes
	CustomLog /var/log/httpd/domains/ronnietest.server.nl.log combined
	ErrorLog /var/log/httpd/domains/ronnietest.server.nl.error.log
	<Directory /home/ronnietest/domains/ronnietest.server.nl/public_html>
		Options +Includes -Indexes
		php_admin_flag engine ON
		<IfModule !mod_php6.c>
			php_admin_flag safe_mode OFF
		</IfModule>
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'
		php_admin_value open_basedir /home/ronnietest/:/tmp:/var/tmp:/usr/local/lib/php/
	</Directory>
</VirtualHost>
<VirtualHost 77.74.49.156:80>
  ServerName webmail.ronnietest.server.nl
  ServerAlias mail.ronnietest.server.nl
  ServerAdmin [email protected]
  DocumentRoot /home/aserver/domains/webmail.server.nl/public_html
  CustomLog /var/log/httpd/domains/ronnietest.server.nl.bytes bytes
  CustomLog /var/log/httpd/domains/ronnietest.server.nl.log combined
  ErrorLog /var/log/httpd/domains/ronnietest.server.nl.error.log
</VirtualHost>

<VirtualHost 77.74.49.156:443 >
	SSLEngine on
	SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
	SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
	SSLCACertificateFile /etc/httpd/conf/ssl.crt/server.ca
	ServerName www.ronnietest.server.nl
	ServerAlias www.ronnietest.server.nl ronnietest.server.nl 
	ServerAdmin [email protected]
	DocumentRoot /home/ronnietest/domains/ronnietest.server.nl/private_html
	ScriptAlias /cgi-bin/ /home/ronnietest/domains/ronnietest.server.nl/public_html/cgi-bin/
	UseCanonicalName OFF
	<IfModule !mod_ruid2.c>
		SuexecUserGroup ronnietest ronnietest
	</IfModule>
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid ronnietest ronnietest
		#RGroups apache access
		RGroups @none
	</IfModule>
	CustomLog /var/log/httpd/domains/ronnietest.server.nl.bytes bytes
	CustomLog /var/log/httpd/domains/ronnietest.server.nl.log combined
	ErrorLog /var/log/httpd/domains/ronnietest.server.nl.error.log
	<FilesMatch "\.(inc|php|phtml|phps|php56)$">
		AddHandler "proxy:unix:/usr/local/php56/sockets/ronnietest.sock|fcgi://localhost" .inc .php .phtml .php56
	</FilesMatch> 
	<Directory /home/ronnietest/domains/ronnietest.server.nl/private_html>
		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'
		php_admin_value mail.log /home/ronnietest/.php/php-mail.log
		php_admin_value open_basedir /home/ronnietest/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php56/lib/php/:/usr/local/php53/lib/php/
		<FilesMatch "\.php53$">
			AddHandler application/x-httpd-php .php53
		</FilesMatch>
	</Directory>
</VirtualHost>

It's driving me crazy :(
 
Hello,

Make sure that you run:
Code:
./build rewrite_confs
?

and don't have outdated and/or customized templates in:
Code:
ls /usr/local/directadmin/data/templates/custom/virtual_host2*.conf
?
 
Back
Top