Enable Register_Globals Print

  • 0

To enable register_globals globally

locate php.ini (should be at /var/lib/php.ini)
Backup php.ini to php.ini-0ri1

nano php.ini
Search register_globals
change setting "register_globals = On"
restart apache

==================

Register_Globals for single user

cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf-ori1
nano /usr/local/apache/conf/httpd.conf

search for the domain name for which you want to have register_globals on. Lets say you want to turn register_globals on for domain.com then search domain.com in httpd.conf,you will find a Virtualhost section for domain.com as mentioned below and add php_admin_flag register_globals on in this section as I added:

===========================

ServerAlias www.domain.com domain.com
ServerAdmin
webmaster@domain.com
DocumentRoot /home/username/public_html
BytesLog domlogs/domain.com-bytes_log
ServerName www.domain.com
User username
Group username
CustomLog domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
php_admin_flag register_globals on

===========================

Then save the httpd.conf file and restart apache.

Then go to the Domain public_html directory
Create file public_html/.htaccess
Put this line on it "php_flag register_globals on"



=========================


If PHP is compiled as PHPSuExec (CGI) you should put php variables (in our case register_globals) into php.ini in the folder where php scripts are located. Just create php.ini and put the following line:

register_globals = On

PHP variables can be also set in httpd.conf, but make sure they are added correctly as in the example below:

< VirtualHost 127.0.0.1 >
ServerAlias www.domain.com domain.com
ServerAdmin
webmaster@domain.com
DocumentRoot /home/username/public_html
BytesLog domlogs/domain.com-bytes_log
ServerName www.domain.com
User username
Group username
CustomLog domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
< IfModule mod_php4.c >
php_flag register_globals on
< /IfModule >
< /VirtualHost >

or just put the following lines into the file .htaccess:
< IfModule mod_php4.c >
php_flag register_globals on
< /IfModule >

Was this answer helpful?

« Back