Multiple PHP versions

Suurbier

Verified User
Joined
Apr 23, 2007
Messages
224
I think it is a good idea to design a new feature that can have multiple php versions installed (like PHP5.2, PHP5.3, PHP6 together!). There are some workarounds for it that indicates that more people want the same..:rolleyes:
 
Last edited:
no sense using php 5.2 anymore :D

PHP 5.2.17 (Old stable)
This version is no longer supported by PHP.net

being exploited...priceless
 
So does everything now work with php5.3? What kind of errors will our clients run into?

Jeff
 
I had updated from 5.2 to 5.3 time ago but many customers using cms was starting to get error on deprecated functions and i had to switch back 5.2 :/

Didnt know was no more supported in that way... i think im gonna try update it again and try to understand with customer how to solve their problem.. but will be an hard work...
 
Hopefully things will go more smoothly this time. l I hope you'll keep us posted. Any good or bad experiences from anyone else on updating to 5.3, and how it affects users?

Thanks.

Jeff
 
Well, maybe I am going to update these days from 5.2 to 5.3. I have a lot of Joomla, Wordpress and custom made websites (and some deprecated functions). A while ago i saw a single command line that checks all files in a directory for a specific word in the file (finding a deprecated function). Does anyone know what I mean? Is someone does, please help me find depreciated functions so I can switch to 5.3:cool:
 
Last edited:
the command for find a word or a sentence in all file is

Code:
grep -R "WHAT IVE TO FIND" /home/USER/domains/DOMAIN/public_html/*

This will tell you the file and cat the line with the exact sentence (or word).

I suppose that USER should be also used with * but not sure.

Regards
 
the command for find a word or a sentence in all file is

Code:
grep -R "WHAT IVE TO FIND" /home/USER/domains/DOMAIN/public_html/*

This will tell you the file and cat the line with the exact sentence (or word).

I suppose that USER should be also used with * but not sure.

Regards

Thanks! I also found the command on php.net community

You'll have to use an instance of sed like:

sed -i 's/\$HTTP_SERVER_VARS/\$_SERVER/g'
i.e.
find ./ -name "*.php" -exec sed -i 's/\$HTTP_POST_VARS/\$_POST/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_GET_VARS/\$_GET/g' {} \;
...

for each of the deprecated variables you might have in your files.

It also occurred to me a simple php conversion script would also work:

$search=array(
"/HTTP_SERVER_VARS/",
"/HTTP_POST_VARS/",
"/HTTP_ENV_VARS/",
"/HTTP_GET_VARS/",
"/HTTP_COOKIE_VARS/",
"/HTTP_SESSION_VARS/",
"/HTTP_POST_FILES/");
$replace=array(
"_SERVER",
"_POST",
"_ENV",
"_GET",
"_COOKIES",
"_SESSION","_FILES");
$content=file_get_contents("somefile.php");
$content=preg_replace($search,$replace,$content);
file_put_contents("somefile.php",$content);

add directory recursion functions, ect.
 
I migrated from PHP 5.2 to 5.3 in 2 hours time! The following commands helped me, i replaced backwards incompatible globals and turned off deprecated errors in php.ini and I recompiled suhosin and eacccelerator:)

these are the following commands i submitted to replace old vars
find ./ -name "*.php" -exec sed -i 's/\$HTTP_POST_VARS/\$_POST/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_GET_VARS/\$_GET/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_SESSION_VARS/\$_SESSION/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_COOKIE_VARS/\$_COOKIE/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_ENV_VARS/\$_ENV/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_SERVER_VARS/\$_SERVER/g' {} \;
find ./ -name "*.php" -exec sed -i 's/\$HTTP_POST_FILES/\$_FILES/g' {} \;

make sure you also read; http://www.php.net/manual/en/migration53.incompatible.php
 
Last edited:
What error was showing the deprecated errors?

Some scripts are using eregi and ereg_replace, so i used the following in php.ini
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

I guess something like....
Yep

no sense using php 5.2 anymore :D

PHP 5.2.17 (Old stable)
This version is no longer supported by PHP.net

being exploited...priceless

5.2.17 is not end of life (yet) at least it is end of developing/support (or something), critical bugs will be solved for sure.
Anyway I am running 5.3 now, but i still vote for a multiple php feature :D
 
Last edited:
And there are no "replacement" for those functions?

Should those cause problem to websites?

Thanks for explanations

Regards
 
And there are no "replacement" for those functions?

Should those cause problem to websites?

Thanks for explanations

Regards

Deprecated functions can still be used, it only gives an error but it still works. In PHP6 all deprecated functions will be removed.

The following is a list of deprecated INI directives. Use of any of these INI directives will cause an E_DEPRECATED error to be thrown at startup.

define_syslog_variables
register_globals
register_long_arrays
safe_mode
magic_quotes_gpc
magic_quotes_runtime
magic_quotes_sybase
Comments starting with '#' are now deprecated in .INI files.
Deprecated functions:

call_user_method() (use call_user_func() instead)
call_user_method_array() (use call_user_func_array() instead)
define_syslog_variables()
dl()
ereg() (use preg_match() instead)
ereg_replace() (use preg_replace() instead)
eregi() (use preg_match() with the 'i' modifier instead)
eregi_replace() (use preg_replace() with the 'i' modifier instead)
set_magic_quotes_runtime() and its alias, magic_quotes_runtime()
session_register() (use the $_SESSION superglobal instead)
session_unregister() (use the $_SESSION superglobal instead)
session_is_registered() (use the $_SESSION superglobal instead)
set_socket_blocking() (use stream_set_blocking() instead)
split() (use preg_split() instead)
spliti() (use preg_split() with the 'i' modifier instead)
sql_regcase()
mysql_db_query() (use mysql_select_db() and mysql_query() instead)
mysql_escape_string() (use mysql_real_escape_string() instead)
Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead.
The is_dst parameter to mktime(). Use the new timezone handling functions instead.
Deprecated features:

Assigning the return value of new by reference is now deprecated.
Call-time pass-by-reference is now deprecated.
 
What i mean is why did you not edited those function aswell with that script? Different syntax?

Im asking cause i dont wanna think is just other line to add to script and then fkup customers websites with wrong syntax or whatever :)
 
And how many commercial scripts encoded with Zend and other encoders will be broken... and sometimes it costs money to get updates for software. And if prolongation of updates period costs hundreds of dollars, what a customer will choose? Another hosting with $5-10 /month with support of 5.2, or to pay those hundreds of dollars to update outdated (but working and fully satisfying all needs of a customer) software?
 
Im lucky, none of my customers using commercial software, most of them are just html or cms like joomla wordpress php-nuke and similar...

Actually a user that have a commercial software should have support and regular updates that would include the edit needed for php 5.3 (for example or aswell mysql 5.5), ofc, depend on software :)

Regards
 
Hmm, it's rare nowadays to meet a commercial software with LifeTime support for upgrades. Usually you should pay dollars yearly to get updates.

Yes, you're lucky.
 
I dont have any customers on my server :)
For those who are running a server without customers, give it a try?
 
Back
Top