PHP 5.6 and 5.2 (multiple PHP) possible with DA 1.51 / custombuild 2?

ErikR

Verified User
Joined
Aug 18, 2005
Messages
20
Hi,

For and old PHP application I need PHP 5.2 on my server. Is it possible to install multiple PHP with this version on DA 1.51 and custombuild 2? Now I run PHP 5.6 only.

Tx
 
Custombuild 2 does not support PHP 5.2. I do have a server with Custombuild 2 and PHP 5.2 as well as all other possible PHP versions:

/usr/local/php52-cgi/bin/php
/usr/local/php53/bin/php
/usr/local/php54/bin/php
/usr/local/php55/bin/php
/usr/local/php56/bin/php
/usr/local/php70/bin/php
/usr/local/php71/bin/php

but it's suPHP, not PHP-FPM, and custombuild options on that server are as the following:

Code:
PHP (default): 5.6 as suphp
PHP (additional): 5.3 as suphp

a nice feature there is in CustomBuild:

Code:
./build php_expert php_release php_mode

which allows to install all possible PHP versions, but not 5.2... and only two versions with a PHP switcher in Directadmin.

PHP 5.2 was installed by CustomBuild 1.x:

Code:
/usr/local/directadmin/custombuild//usr/local/directadmin/custombuild_1/

with a customized directives in custom/suphp/configure.php52. That's all due to old commercial CMS which run only under specific PHP versions.

As Richard already mentioned there are guides on the forums, so you can find them.
 
Oeps, thank you for the correction there Alex. Sorry about my mistake ErikR.

It's with 5.3 and 5.6 then with php-fpm correct?
 
next step?

And after building all php versions with expert option, what files should we edit to can use.
Thank you.
 
I am using suphp, for test installation, but you can help us with all situations.
 
I will list here some ideas what to change and where for suPHP (as how I use it). It's up to you to adapt it for fastcgi and FPM and protect listed files from being overwritten by directadmin. I don't have a goal to write a complete and full guide on the matter.


PHP versions:

Code:
# ls -1d /usr/local/php*/
/usr/local/php52/
/usr/local/php53/
/usr/local/php54/
/usr/local/php55/
/usr/local/php56/
/usr/local/php70/
/usr/local/php71/
/usr/local/php72/

/usr/local/suphp/etc/suphp.conf:

Code:
;Handler for php-scripts
x-httpd-php52="php:/usr/local/php52/bin/php-cgi52"
x-httpd-php53="php:/usr/local/php53/bin/php-cgi53"
x-httpd-php54="php:/usr/local/php54/bin/php-cgi54"
x-httpd-php55="php:/usr/local/php55/bin/php-cgi55"
x-httpd-php56="php:/usr/local/php56/bin/php-cgi56"
x-httpd-php70="php:/usr/local/php70/bin/php-cgi70"
x-httpd-php71="php:/usr/local/php71/bin/php-cgi71"
x-httpd-php72="php:/usr/local/php71/bin/php-cgi72"



/etc/httpd/conf/extra/httpd-suphp.conf:

Code:
<IfModule mod_suphp.c>
    <FilesMatch "\.php52$">
        AddHandler x-httpd-php52 .php52
    </FilesMatch>
    <FilesMatch "\.php53$">
        AddHandler x-httpd-php53 .php53
    </FilesMatch>
    <FilesMatch "\.php54$">
        AddHandler x-httpd-php54 .php54
    </FilesMatch>
    <FilesMatch "\.php55$">
        AddHandler x-httpd-php55 .php55
    </FilesMatch>
    <FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php54|php55|php56|php6|phtml|phps)$">
        AddHandler x-httpd-php56 .inc .php .php3 .php4 .php5 .php56 .phtml
    </FilesMatch>
    <FilesMatch "\.php70$">
        AddHandler x-httpd-php70 .php70
    </FilesMatch>
    <FilesMatch "\.php71$">
        AddHandler x-httpd-php71 .php71
    </FilesMatch>
    <FilesMatch "\.php72$">
        AddHandler x-httpd-php72 .php72
    </FilesMatch>
    <Location />
        ##suPHP_Engine on
        ##suPHP_ConfigPath /usr/local/php53/lib/
        suPHP_AddHandler x-httpd-php52
        suPHP_AddHandler x-httpd-php53
        suPHP_AddHandler x-httpd-php54
        suPHP_AddHandler x-httpd-php55
        suPHP_AddHandler x-httpd-php56
        suPHP_AddHandler x-httpd-php70
        suPHP_AddHandler x-httpd-php71
        suPHP_AddHandler x-httpd-php72
    </Location>
</IfModule>


.htaccess

Code:
<IfModule mod_suphp.c>
<FilesMatch "\.(inc|php|php3|php4|php5|php6|phtml|phps)$">
        AddHandler x-httpd-php52 .inc .php .php3 .php4 .php5 .php6 .phtml
</FilesMatch>
</IfModule>

That's it.
 
php-fpm?

It's working with suphp, i have 7 php versions editable from .htaccess
Please tell me what to edit for php-fpm to work after compilation.

Thank you.
 
It's up to you to adapt it for fastcgi and FPM.Contact me for a quote if you want me to do FPM for you. With PHP-FPM a custom scripting is required in order to manage FPM pools.
 
I am using this forum to get support for directadmin for free.
I look for advices, not for somebody to work for me.
I am not interested to pay more than directadmin.
And sure... only 2 php versions suck big time.....

So... advices for suphp went fine, but i thing php-fpm will be faster. Some directions for php-fpm?
 
I don't work for Directadmin... and I spent my time here to give free support as much as time permits. I don't have a guide for other than suphp, so it's up to you to learn how directadmin manages the things with PHP-FPM and adapt the idea to work with PHP-FPM.
 
The problem is solved.
I succeded to configure php-fpm with 5.3, 5.4, 5.5, 5.6, 7.0, 7.1 or 7.2 at my choice using .htaccess

It is ok if i am writing a quick tutorial about this? zEitEr?
 
The problem is solved.
I succeded to configure php-fpm with 5.3, 5.4, 5.5, 5.6, 7.0, 7.1 or 7.2 at my choice using .htaccess

It is ok if i am writing a quick tutorial about this? zEitEr?

I would not mind seeing this, and would then like to see if could be modified for nginx users
but I am not a mod or anything so its up to them
 
If you have 5.6 and 7.2 php-fpm and you need additional php version follow the next steps:
I use nginx_apache webserver.

1. build a new php version, lets say 5.3, but you may repeat the process for 5.4, 5.5, 7.0 and 7.1

cd /usr/local/directadmin/custombuild
./build update
./build php_expert 5.3 php-fpm


2. create config file for php-fpm5.3 for user XXX

cd /usr/local/directadmin/data/users/XXX/php/
cp php-fpm56.conf php-fpm53.conf
edit php-fpm53.conf and replace line
listen = /usr/local/php56/sockets/$pool.sock
with
listen = /usr/local/php53/sockets/$pool.sock


3. restart service (i am using centos on my test server for example)
systemctl restart php-fpm53.service

if /etc/systemd/system/php-fpm53.service does not exist, you must create it from a similar one from /etc/systemd/system/php-fpm56.service

4. edit .htaccess, replace XXX with your user

<FilesMatch "\.(inc|php|phtml|phps)$">
SetHandler proxy:unix:/usr/local/php53/sockets/XXX.sock|fcgi://localhost/
</FilesMatch>


5. test if all good.
 
Last edited:
SetHandler proxy:unix:/usr/local/php53/sockets/XXX.sock|fcgi://localhost/
doesn't that make it fcgi and not fpm mode though?
or am I (very very possible) looking at it incorrectly?
 
ok, but can you explain/teach me why?
or point me to material that does so?
I can see the build process using fpm, so it is it "faking" the fcgi process amd socket into using fpm?
 
Dave,

PHP-FPM in basics it is still fastcgi but with a process manager (FPM is read as FastCGI Process Manager), and a FPM-daemon can run independently on a web-server.

Directadmin implements fpm and fastcgi differently, check /usr/local/directadmin/data/templates/virtual_host2.conf to see the difference.

And if we read docs:

FPM is an alternative PHP FastCGI implementation with some additional features (mostly) useful for heavy-loaded sites.

More reading at http://php.net/manual/en/install.fpm.php
 
Back
Top