mkdir -p /usr/local/Zend/register-enabled
cp /usr/local/Zend/etc/php.ini /usr/local/Zend/register-enabled
vi /usr/local/Zend/register-enabled/php.ini
vi /etc/httpd/conf/httpd.conf
<Location /store>
suPHP_ConfigPath /usr/local/Zend/register-enabled
</Location>
<?
ini_set('register_globals', 'on');
import_request_variables("cpg");
?>
That wont work when using suphp.Under the domain's base directory, most likely www or public_html, create a .htaccess file and include the following in it.
php_value register_globals on
Yes ... AbsolutelyThank you very much for that in depth post. Will this work with Apache 2?
These are instructions for doing this with Apache 1.3, not using cPanel's suPHP solution, but I suspect that the directions are the same or very similar.
You would have to copy the server-wide php.ini to a different directory and then change that new version of the php.ini file so that register_globals is on.
You would then need to specify that path for that specific VirtualHost within the httpd.conf file using the suPHP_ConfigPath directive to point to that new php.ini file.
For example, say you have an account domain.com.
The account has an osCommerce install at domain.com/store that needs register_globals enabled.
For the sake of argument, your server-wide php.ini file is located at /usr/local/Zend/etc/php.ini.
Create a new directory and copy that php.ini to that directory.
Now edit the new version of that php.ini file (I use vi, but any other command line text editor will suffice)Code:mkdir -p /usr/local/Zend/register-enabled cp /usr/local/Zend/etc/php.ini /usr/local/Zend/register-enabled
You will have to find where register_globals is defined and changed Off to On.Code:vi /usr/local/Zend/register-enabled/php.ini
Save the file
Now edit the Apache configuration file.
Find the specific VirtualHost section.Code:vi /etc/httpd/conf/httpd.conf
If there is a section in the VirtualHost that reads:
<IfModule mod_suphp.c>
.
.
</IfModule>
Then add this line of code within that <IfModule> bracket:
The <IfModule mod_suphp.c> would not be completely necessary, but in general is a good rule of thumb.Code:<Location /store> suPHP_ConfigPath /usr/local/Zend/register-enabled </Location>
The important aspects are the suPHP_ConfigPath line which defines which configuration files to use. And the <Location> bracket which basically says to use this php.ini file when accessing files under the /store directory on this website.
Important Note: The suPHP_ConfigPath only needs to point to the directory where the php.ini file is located in. It does not need to include the full path including the php.ini filename.
In order for these instructions to work, you have to have suPHP enabled on your server and running PHP through suPHP. I really do not know anything about cPanel's suPHP offering. I think it is only available in EasyApache3 and for Apache2, but I may be mistaken there.just checking for the above instructions to be carried out.. what are the pre-requistes?
enable or install suphp from whm?
anyone wrote a how-to from this instructions? am not very good at this.. need some step-by-step help.
just need to enable register_globals=on for 1 site...![]()
yes .. the developers of one of my client did not do a good job.However, personally in regards to register_globals (and to go a little off-topic) I would question whether or not the script is up-to-date. If a script is requiring register_globals to be on in order to work, then this raises a red flag that the script is not up-to-date or the developers of the script don't care enough about the security of their product.
As you can see, I tried various ways. Any suggestions?[Wed Jun 20 11:19:43 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 11:19:43 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 11:06:21 2007] [error] [client 198.54.202.130] File does not exist: /home/itprinte/public_html/call-logging/404.shtml
[Wed Jun 20 11:06:21 2007] [error] [client 198.54.202.130] File does not exist: /home/itprinte/public_html/call-logging/ase.gif
[Wed Jun 20 11:01:58 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 11:01:58 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 11:00:30 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'ini_set('register_globals',', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 11:00:30 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'ini_set('register_globals',', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 10:58:18 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'register_globals', perhaps mis-spelled or defined by a module not included in the server configuration
[Wed Jun 20 10:58:18 2007] [alert] [client 198.54.202.130] /home/itprinte/public_html/call-logging/.htaccess: Invalid command 'register_globals', perhaps mis-spelled or defined by a module not included in the server configuration
I'm fairly sure this ini_set example won't work; the reason being that the register_global actions are taken BEFORE the script starts. If you try this method, register_global is indeed set for the rest of that session, but TOO LATE to actually register the globals. You could actually do the "global registering" instead manually via a PHP function - see http://php.net/import_request_variablesHello,
If your customer coding his own php script. Tell to use this
If you add this to any php script head, It will open register_globals for currently running script or page. But your customer will be need to add this code to his/her all php page's. Otherwise register_global will not work.PHP:<? ini_set('register_globals', 'on'); import_request_variables("cpg"); ?>
Hi Spiral, can you help me with an example for SuPHP?, I have suPHP with apache5, i made a new folder with a copy of the default php.ini file, have it edited to turn the register globals on and then in the httpd.conf fine i added the line to point to the new folder likeSetting custom settings for a specific site is done differently depending
in any of three ways depending on whether you are using Apache module
based PHP, phpSuExec (CGI), or SuPHP (CGI) ...
SuPHP
----------------------
You would add a "suPHP_ConfigPath" command giving the folder location
of a custom PHP.INI file with the the vhost section of the httpd.conf file
for the site you want to modify settings.
Will the this (above) method work if you have Apache v2 and the php.ini path locked down via:Setting custom settings for a specific site is done differently depending
in any of three ways depending on whether you are using Apache module
based PHP, phpSuExec (CGI), or SuPHP (CGI) ...
SuPHP
----------------------
You would add a "suPHP_ConfigPath" command giving the folder location
of a custom PHP.INI file with the the vhost section of the httpd.conf file
for the site you want to modify settings.
Any Update ?Will the this (above) method work if you have Apache v2 and the php.ini path locked down via:
/opt/suphp/etc/suphp.conf
[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
application/x-httpd-php=/usr/local/lib/
application/x-httpd-php4=/usr/local/php4/lib/
application/x-httpd-php5=/usr/local/lib/
Probably not, huh?
Ideally I am looking for either a way of providing custom php.ini files for accounts that need certain features that the owners of those vsites will NOT be able to change. OR, a way of limiting the features that ini_set can enable.
Is this this impossible dream of securing php but leaving it functional, or what?
I would dearly love to switch off ini_set except for the vsites who need it WITHOUT allowing them to set up their own php.ini files. I am almost shocked that there is such an "either-or" security question in the php v5.2.10 system and that there is not a more flexible way of dealing with this particular issue. I have been searching for days for a solution in this regard.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | Turning off gzip | Web Servers and Applications | 3 | |
![]() |
max_children value return to 25 | Web Servers and Applications | 8 | |
S | turn on locally register_globals on PHP5? | Web Servers and Applications | 10 | |
R | cannot turn on register_globals | Web Servers and Applications | 1 | |
B | How t turn on register_globals? | Web Servers and Applications | 6 |