Softpedia
 

NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home > News > Webmaster > Tips and Tricks

September 20th, 2007, 15:45 GMT · By Catalin Bocanu

Old PHP Scripts Compatibility with Actual Hosting Services

SHARE:

Adjust text size:


php_info Function Output
Enlarge picture
PHP programming language provides you a simple way to define functions and variables. The concept of PHP variables is complex in ensemble, but for start let's say that variables used inside PHP code begin with the $ sign and do not need to be initialised.

You must make the difference between
older versions of PHP, when variables had a global character and the newest PHP versions in which variables are super globals.

For example, older PHP scripts, made before the apparition of PHP 4.2 version are not using super global definition of variables and as a consequence they will not work on the new versions of PHP, because the default setting in PHP configuration file (PHP.ini) is register_globals off.

You should not be surprised that when you test an older script you cannot run it, but it is a solution for this problem: turn register_globals on in php.ini by modifying the appropriate line. If you use an online webserver, then this setting is not recommended from security reasons.

If you are a PHP coder and use old PHP templates, you should consider rewriting them in order to be compatible with actual Apache and PHP distributions. You can check the script requirements to see if it requires the register_globals to be on. Depending on the webhosting service, there are still situations when register_globals is enabled in php.ini file.

If you do not have access to the server configuration files you can add a .htaccess file to the root directory of your PHP script in order to be able to use scripts that require register_globals on. The .htaccess file must contain the line

CODE
php_admin_flag register_globals on

Another way to enable the register_globals on is to use the function ini_set() inside your PHP scripts. You can check the register_globals status (on or off) by using php_info() function or the appropriate option in your web account control panel. In order to have applications easy to maintain, portable, secure and with an optimal performance it is recommended to maintain the register_globals off setting and to convert the old code to the actual specifications of PHP coding standards.

TELL US WHAT YOU THINK:

2,040 hits · Link to this article · Print article · Send to friend · Subscribe to news

MUST-READ RELATED ARTICLES:


An Introduction to php.ini

The World of PHP

PHP Critical Vulnerabilities!

How to Install phpMyAdmin on Windows

Is Joomla! The Best CMS on the Planet?

READER COMMENTS:



No user comments yet.
Be the first to express your opinion!
Copyright © 2001-2012 Softpedia. Contact/Tip us at

WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM