Lounge Network - Knowledge Base

  View Printer Friendly Version Search
KNOWLEDGE BASE HOME » 15. INFORMATION: SCRIPT AND PROGRAMMING QUESTIONS Viewing Answer
How do I turn Register Globals off?

For Corporate and Business Hosting Plans, please following the instructions on this page http://knowledgebase.loungenetwork.co.nz//index.php?op=view&t=250

For CPanel Based Hosting Plans, please follow the instructions below:


====================================================================
LIBRA SERVER (Under PHP 4 & 5) and CONCORDE SERVER (Under PHP 4 & 5):
====================================================================

CPanel based servers use phpsuexec, and phpsuexec will ignore all php_flag options in .htaccess files. Therefore you must use the following method to turn register_globals to off.


You will need to enter the command

register_globals = off

into a php.ini file. You can create an php.ini file, by using a text editor such as microsoft notepad, typing in the command, and then saving the file as php.ini .
This php.ini file then must go into a new folder that you must create, which you must name _custom_php_settings (this must be typed exactly like this). This _custom_php_settings folder and php.ini file inside it, needs to go into the folder of the script. This will need to be home/user/public_html/folderofscript/_custom_php_settings or similar. Replace user with your cPanel login username. This _custom_php_settings folder and php.ini file must go into ALL directories and subdirectories that contains php files that you need register_globals turning off. There are also tools available that can automatically copy these folders and php.ini files into all folders and sub folders.

It is also possible to put the php.ini file directly in the folder of the script, but this will reset all PHP settings to the default. This page describes the difference in techniques http://knowledgebase.loungenetwork.co.nz//index.php?op=view&t=270

If you would like to test that it is working, you will need to upload a phpinfo.php file into each directory that you want to test, and then load the phpinfo.php file in your webbrowser. This will then show you what settings are on and off. Instructions showing how to create a phpinfo.php file can be found at http://knowledgebase.loungenetwork.co.nz/index.php?op=view&t=282



If you have already got a file named php.ini file in the _custom_php_setting folder and you don't want to alter it or it's settings, you can command register_globals to off by following the instructions below.

1) Create a folder named _custom_php_settings in the directory the script is running in. If the script is in directory /home/user/public_html/script then you will create the directory /home/user/public_html/script/_custom_php_settings. Replace user with your cPanel login username.

2) Create a file named settings.ini that contains register_globals = off in the same format as a php.ini file.

3) Upload the settings.ini into the _custom_php_settings folder (you may need to create this folder if it isn't there) . The settings.ini file can override any php.ini setting without replacing the php.ini file entirely.


KNOWLEDGE BASE HOME » 15. INFORMATION: SCRIPT AND PROGRAMMING QUESTIONS Viewing Answer




Knowledgebase Manager

© Copyright Lounge Network 2001-2017