Does this mean that every server that uses mod_php is going to have this mode removed from the server? There are some older applications/servers that cannot do without this mode. What will this mean for all these servers? How do we move away from this mode?
Hi Patrick,
I wil try and tell you what I know and do, so far. It may be a guide for you to get started.
Did you install php-fpm yet on your server? Also, check htscanner, it is a module to help you migrate, it can be left out if you are willing to manually remove php_* settings from .htaccess and place them in .user.ini.
Move any PHP settings to .user.ini
If you’re currently changing any
PHP settings in Apache configuration files, move these to a
.user.ini file which is picked up by PHP-FPM. So e.g., if you have
.htaccess file with:
php_value include_path ".:/php_lib"
php_value auto_prepend_file "autoload.php"
Change it to this equivalent
.user.ini file (note the syntax is different):
include_path =
'.:
/php_lib'
auto_prepend_file = 'autoload.php'
A way how to find these occurrences:
Code:
cd /home
find */domains/*/*html/ -type f -name .htaccess -exec grep -HirE "php.*(flag|value)" {} \;
More on
php.net.
You also need to scan your scripts, check if they use Apache specific calls.
* apache_*(
* getallheaders(
* virtual(
A way how to find these occurrences:
Code:
cd /home
find */domains/*/*html/ -type f -name "*.php" -exec grep -H "apache_" {} \;
find */domains/*/*html/ -type f -name "*.php" -exec grep -H "getallheaders" {} \;
find */domains/*/*html/ -type f -name "*.php" -exec grep -H "virtual" {} \;
Suppose your one and only php version is 5.6 with mod_php? I recommend to add a second php version, either 5.5 or 7.0. If you would do so, you then have the option to change (per domain) the php version and test the website. With some clever tweaking you can use a dummy domain, use 'ln -s' to link to an existing 5.6 site and thus test the newer version locally. (you will need unix and scripting experience to do this, it won't work out of the box).
I would not recommend to 'just replace php with mod_php to php with php-fpm'.
One drawback is DA does not support 2 times the same php version, you can not have 5.6 mod_php active as well as 5.6 php-fpm. That is why I would recommend to use 5.5 with php-fpm for testing.
With all of this info you should be able to start migrating. I am doing MANY servers currently, and having the time of my life, since DA only gave 1 month up ahead. And they don't say what will happen 1-1-2023 if you continue using mod_php. Having said that, I am 100% sure not much will change or happen. It is just that you can not change TO mod_php anymore. Or use (switch on) mod_ruid2 (on CentOS 7) via custombuild anymore. But what was working will continue working. But as soon as you make changes in the php version, things MAY go wrong,
./build rewrite_confs may no longer support it (DA: please step in and tell us how you will implement this, what can we expect?).
There is one more script very useful, however it needs to be changed since it only contains maximal 2 php versions.
I upgraded the script to support 3 versions, and it can be modified further to support all 4 of them.
And maybe
this script can be of use (but it has no mod_php or php-fpm setting in it).
One more note. You do can switch php versions. Suppose php version one is 5.6 mod_php and version 2 is 7.4 php-fpm. As long as both are upgraded to the latest version, you can use custombuild to swap their places. It will not do any compiling. Do not forget to do ./build rewrite_confs. A reason for doing this is that al of your webapps are using php version 1. (phpmyadmin, roundcube and such). You can't do updates on the webapps, they do check the php version. * after the swap you need to use the change_domain_phpver.sh to change all domains. I found out the best way is to temporarily make a remark of the 2 lines at the end of the script:
#/usr/local/directadmin/dataskq
Doing this enables you to update all domains (use a script, clever copy and pasting may do the job already). And only when done, you would call
/usr/local/directadmin/dataskq twice yourself. DA is running and MAY already see your changes, but that would be no more than a hickup I guess, I recommend to run the script(s) just 1 second after the whole minute has passed, I suspect datatask runds every whole minute (this needs verification).
NOTE: I may have missed documenting details for sure. Those must be minor details I think. You may have custom templates and other changes that will make your situation different from mine.