execute some php files as php 7.3, default version is php 5.6

Wanabo

Verified User
Joined
Jan 19, 2013
Messages
339
This is bugging me for some time now.

I have 4 php versions installed. (2 and 3 are actually obsolete)
php1_release=5.6
php1_mode=php-fpm
php2_release=7.1
php2_mode=php-fpm
php3_release=7.2
php3_mode=php-fpm
php4_release=7.3
php4_mode=php-fpm

I haven an old script that does not work with php7, but some files are compatible with php7
So I want to execute some php files as php version 7.3 where the rest of the php files are default executed as php 5.6.

By searching the forums I found:
http://forum.directadmin.com/showthread.php?t=57934&p=295880#post295880 and
https://forum.directadmin.com/showthread.php?t=52531&p=286178#post286178

I created an .htaccess file with this content and put it in a subdirectory:
Code:
<FilesMatch "\.(php|php73)$">
AddHandler "proxy:unix:/usr/local/php73/sockets/someusername.sock|fcgi://localhost" .php .php73
</FilesMatch>
Created a phpinfo file test.php in the same directory with content:
Code:
<?php phpinfo(); ?>
The test.php file is not parsed as php 7.3 but is still php 5.6.
When I change the extension to test.php73 the file is parsed as php 7.3.
But that is not what I want. Somehow the default overrides the htaccess file.
How to make test.php parsed by php 7.3?
 
I guess you need to update via "Custom HTTPD configuration" directly in the VirtualHost, not via .htaccess.
 
Thanks wattie, I will experiment in "Custom HTTPD configuration".
If that fails I'll try a search and replace in the php files to change some files to .php73
 
A working script throwing errors is a challenge, but worth a try. I have some experience in this matter.
This php script does nothing when on php 7.x.
I suppose I could debug the error log.

But the idea to parse only a few php files with php 7 is because I can track how many times a php file is requested. So I want only the top 5 files on php 7.x to increase speed, lower server stress and reduce memory consumption.

The script is an ad exchange script, the site, user area and admin area are not that often used. Only the files needed for showing ads on websites worldwide. These get hit often, therefore I only want these files on php 7.

A lazy person is looking for smart solutions. ;)
 
I suppose I could debug the error log.
That would be the thing. I fixed some older php script the same way. And I only know little php, but error notices and Google helped a lot. :)
To me, that would be a challenge.

However at this moment very busy installing a couple of new servers to replace older ones.
 
That would be the thing. I fixed some older php script the same way. And I only know little php, but error notices and DUCKDUCKGO helped a lot. :)
To me, that would be a challenge.

UH Richard don't make free advertisement for those G . hihi ;)

Yup with error and ... or you take a look at PHP docs yourself to find out what changed then use Agent RAnsack for example to check if you have depricated things ...


https://www.php.net/manual/en/migration70.incompatible.php one example but they have all. ;)
Migrating from PHP 5.5.x to PHP 5.6.x
•Migrating from PHP 5.6.x to PHP 7.0.x
•Migrating from PHP 7.0.x to PHP 7.1.x
•Migrating from PHP 7.1.x to PHP 7.2.x
•Migrating from PHP 7.2.x to PHP 7.3.x

Go for minimal 7.2.x better 7.3.x
 
UH Richard don't make free advertisement for those G . hihi :D
I'm sorry, but credit to the one earning the credit. I didn't found the solution by using DD, LoL. :D

I would not go for 7.3 as there is still a lot of stuff out there not supporting 7.3 yet. Even not everybody (for example SMF) is already 7.2 compatible like they in fact should at this point, having php 7.1 EOL and EOS end of this year.
 
Thanks Richard and Ikkeben for your information and suggestions.

I think I clone the site in question and start debugging as I cannot afford downtime.
 
Even not everybody (for example SMF) is already 7.2 compatible like they in fact should at this point

SMF runs fine over PHP 7.3. But they are in beta (rc) version - they did not release a new stable version for years so I don't know how it counts. I think their project is going towards closing.
 
I don't know where you got that form but SMF is not running fine on php 7.3. Officially they even max. run on php 7.1. I had SMF 2.0.14 (or 15) running on 7.2 by using a special mod and 2 mod devs who changed some of their code so it worked. But I did not have heavy customizations.

Most users still use SMF 2.0.x and not 2.1. Maybe a 2.1 beta runs on 7.3 but that is not known to me. The official version is still 2.0.x and not running 7.2 officially.
So they're late either way, but that's oke because it's free.

They are however just an example. They're not the only ones.
 
I did upgrade my forum to SMF 2.1 beta long time ago - maybe like 4-5 years ago :)
I even forgot to up it from beta 2 to RC2 (which I did yesterday after reading this post). During this time I was on the PHP 7.x branch with always going to the latest version ASAP.

SMF 2.0.x did not have any update since more than two years. PHP 7.3 was introduced the last year. With such release cycle it is normal that SMF won't be OK.

But you are right - you can't rely on PHP 7.3 ONLY on shared hosting. You should include an option to switch to old one.

Sadly I had to include such for very old and already out of support one. For the very same reason - too much users with ancient code...
 
Last edited:
P.S. I was one of the guys who contributed for unofficial patch to make SMF 1.1.21 compatible with PHP 7.x (plus I added a fix for a critical CVE issue to it). They worked with PHP 7.2. Never tested with 7.3 because I finally upgraded.
 
I already suspected that you worked with it one way or the other. But there are loads of people not wanting to work with beta or release candidates, as am I. And 2.0.15 is not 7.2 compatible.
There was a little patch from 2.0.14 to 2.0.15 but no big update indeed. Still 2.1 is RC and php 7.1, which is supported by 2.0.15 is end of support end this year. Officially not 7.2 and you can also read for example Arantors comments about that if there are some custom things you will run into trouble.
Also various mods are not 7.2 compatible yet.
I was lucky to get my hand on a cheap complete version of Invisioni so I change to Invision now.
However I did like SMF very much.

But we're getting a bit off-topic I guess. :) Sorry Wanabo.
 
Back
Top