I need temporarily put up an old page on the website. However, for that I need register_globals on. So i set .htaccess the following text:

  1. php_value register_globals = 1

But what i got is error page 500. Go to error log and i found this:

  1. [Apr 9 08:31:04 2008] [alert] [client xx.xxx.xx.xx] /home/xxx/public_html/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration
  2. [Apr 9 08:18:51 2008] [alert] [client xx.xxx.xx.xx] /home/xxx/public_html/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration

As you can see, i got the same error for php_flag too. What am I missing?

Googling!! and hit, I’m feeling lucky!!
Yupz, i’m lucky enough and i found that my server now have PHPSUEXEC enabled.

What is PHPSuexec?

PHPSuexec is the shortened term often used to describe running PHP as a CGI with Suexec. Running PHP as a CGI with Suexec creates a much more secure environment compared to running PHP as an Apache module.

Thats why ‘php_value/flag’ no longer works. So the solution is create a php.ini file and set it like this:

  1. register_globals=1

There is one main difference to the use of .htaccess vs php.ini — a .htaccess file can be placed at the root directory and effect subdirectories with just 1 file, php.ini does not work this way.

A php.ini file needs to be placed in every directory and subdirectory that requires the altered directives. This is a downfall for using PHPSuexec, however i hope that in the future PHP can be written to handle the php.ini file in a more workable fashion.