php_value register_globals on

Hello,

I’ve successfuly test on my domain to create a .htacces with in it this line :
php_value register_globals on

This set ON the globals var in php.

My .htaccess is in a subdirectory.

One of my customer has to set on the global var so I told him to create a .htaccess in his subdirectory but he has an error 500 : .htaccess: php_value not allowed here

nor the php_admin_flag work.

It is as he didn’t have the allowrewrite setup for this domain.

Do you have an idea ?

Thanks
Pascal

Ok it is very strange

I’ve had to create a <directory directive in his domain.com.conf for this subfolder

as :

<Directory /home/domain/domain.net/html/membres>
AllowOverride all
</Directory>

And now it is working fine.

The only one difference I found between his domain.com.conf file and mine is that I have the

php_admin_flag engine On

before the

<directory …
Allowoveride
</directory>

and he has it after the

<directory …
Allowoveride
</directory>

php_admin_flag engine On

As I don’t like to have to modify myself the domaine.com.conf file. So if somebody could tell me the reason why it is working for my domain and not for his domain it could be great

Thanks
Pascal

You’ll need AllowOverride for the domain (or everything) to include either Options or All.

Yes absolutly it’s what I wrote in my previous post.

But my concern is that for the domain : carat-hosting.com I didn’t change anything and the .htacces with the overide php_value works fine. But on some others domain it doesn’t work fine.

The difference between a working domain and a non working one is that :

  • my domain is on a dedicated IP
  • my domain allow CGI

that’s all.

When you create a new siteworx account, siteworx create a domaine.com.conf file in /etc/httpd/conf.d/

Here is a copy of my .conf file which one .htaccess and php_value works fine:

My domain :

<VirtualHost 65.110.36.140:80>

SuexecUserGroup toto toto

DocumentRoot /home/toto/toto.com/html
ServerName toto.com

ServerAlias ftp.toto.com www.toto.com
ServerAdmin webmaster@toto.com

subdomain logic

RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} !^www.toto.com [NC]
RewriteCond %{HTTP_HOST} !^toto.com [NC]
RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-]+).toto.com [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
RewriteRule ^([0-9A-Za-z-]+).toto.com/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]

end subdomain logic

ErrorLog /home/toto/var/toto.com/logs/error.log
CustomLog /home/toto/var/toto.com/logs/transfer.log combined

php_admin_flag engine On

cgi: 1

<Directory /home/toto/toto.com/html>
AllowOverride AuthConfig FileInfo Options Limit Indexes
Options +ExecCGI
</Directory>

ScriptAlias /cgi-bin/ /home/toto/toto.com/html/cgi-bin/

</VirtualHost>

For this one, to create a .htaccess in a subdirectory with this line "php_value register_globals on " works fine

Here is the original domain which the .htaccess with a php_value doesn’t work fine

<VirtualHost 65.110.36.145:80>

SuexecUserGroup titi titi

DocumentRoot /home/titi/titi.net/html
ServerName titi.net

ServerAlias www.titi.net ftp.titi.net mail.titi.net
ServerAdmin webmaster@titi.net

subdomain logic

RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} !^www.titi.net [NC]
RewriteCond %{HTTP_HOST} !^titi.net [NC]
RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-]+).titi.net [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
RewriteRule ^([0-9A-Za-z-]+).titi.net/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]

end subdomain logic

ErrorLog /home/titi/var/titi.net/logs/error.log
CustomLog /home/titi/var/titi.net/logs/transfer.log combined

php_admin_flag engine On

cgi: 0

<Directory /home/titi/titi.net/html>
AllowOverride AuthConfig FileInfo Limit Indexes
</Directory>

Options -ExecCGI

</VirtualHost>

and here is the same domain with the update I made to have .htaccess / php_value working fine. I did add a “allowoverride all” for the subdirectory.

<VirtualHost 65.110.36.145:80>

SuexecUserGroup titi titi

DocumentRoot /home/titi/titi.net/html
ServerName titi.net

ServerAlias www.titi.net ftp.titi.net mail.titi.net
ServerAdmin webmaster@titi.net

subdomain logic

RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} !^www.titi.net [NC]
RewriteCond %{HTTP_HOST} !^titi.net [NC]
RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-]+).titi.net [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
RewriteRule ^([0-9A-Za-z-]+).titi.net/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]

end subdomain logic

ErrorLog /home/titi/var/titi.net/logs/error.log
CustomLog /home/titi/var/titi.net/logs/transfer.log combined

php_admin_flag engine On

cgi: 0

<Directory /home/titi/titi.net/html>
AllowOverride AuthConfig FileInfo Limit Indexes
</Directory>

<Directory /home/titi/titi.net/html/membres>
AllowOverride all
</Directory>

Options -ExecCGI

</VirtualHost>

Why it works fine with the toto.com domain and doesn’t work fine (without update) for the titi.com domain ?

As I already say I don’t like make change to the domain configuration file.

Thanks
Pascal

Sorry, I haven’t gotten much sleep the past 2 weeks :frowning:

Anyway, I’m curious now for an offical word, as a quick grep shows httpd.conf sets AllowOverride to None, and many individual domains have different AllowOverrides. All of the domains on our box except one have Options in AllowOverride.

lol no pbm CMI :slight_smile:

On our boxes some have :
AllowOverride AuthConfig FileInfo Options Limit Indexes

others have :
AllowOverride AuthConfig FileInfo Limit Indexes

So I confirm that on some individual domains there is the Allowoverride Options and on others there is not.

I’m also waiting for an offcial explanation of this.

Thanks CMI

Pascal

Here is the official word :slight_smile:

The reason some vhosts have “AllowOverride Options” and others don’t has to do with the CGI enabled/disabled option.

If CGI is enabled, then the Options option is allowed to be overridden.

If CGI is disabled, then the Options option is not allowed to be overridden. The logic being, if it was allowed to be overridden, you could put “Options +ExecCGI” in a .htaccess file, and then CGI wouldn’t be “disabled” anymore.

Paul

That makes sense :slight_smile:

So then there is no way to give a SiteWorx account .htaccess without blocking just CGI, at least with the way Apache current works?

Without CGI on for an account they can use .htaccess as much as they want, so long as they don’t try and set Options.

It’s true that is makes sense, but the problem is for the register_globals variable.

I don’t want to change this variable in the php.ini file as it also makes sense to have it disabled, but a lot of sites didn’t change yet there site to not use the global variables, so rather than tell us to update all their sites I’d prefere to tell us to create an .htaccess or a similar way to enable this feature on an individual domain basis.

I already successfuly use a script to “likely” use the globals var

if (!defined(‘PMA_GRAB_GLOBALS_INCLUDED’)) {
define(‘PMA_GRAB_GLOBALS_INCLUDED’, 1);

if (!empty($_GET)) {
    extract($_GET);
} else if (!empty($HTTP_GET_VARS)) {
    extract($HTTP_GET_VARS);
} // end if

if (!empty($_POST)) {
    extract($_POST);
} else if (!empty($HTTP_POST_VARS)) {
    extract($HTTP_POST_VARS);
} // end if

if (!empty($_FILES)) {
    while (list($name, $value) = each($_FILES)) {
        $$name = $value['tmp_name'];
    }
} else if (!empty($HTTP_POST_FILES)) {
    while (list($name, $value) = each($HTTP_POST_FILES)) {
        $$name = $value['tmp_name'];
    }
} // end if

} // $PMA_GRAB_GLOBALS_LIB

But some users don’t want change theire sites at all, as they say : my site was working on my previous webhoster so why it doesn’t work now :-p

Is somebody know a way to enable the globals var on an individual domain without having to change the allowoverride Options and without having to create a script to assign global var to var?

Thanks

Pascal

Sure, you can just put an htaccess file in their html or even below their html file with the follow line in it:

php_flag register_globals On

And that should turn it on for that particular account.

Hello Greg,

I’ve already tried it, but it returns me an error :
syntax error apparently, even if the php_flag engine is on it doens’t accept the htaccess file with php_flag register_globals On

Thanks
Pascal

Right below the php_admin_flag engine On line you could add the line php_flag register_globals On in the VirtualHost section of their .conf file.

Ok sorry, maybe I’ve made an error. I done some new tests and it works fine.

Thanks Greg

Pascal

No problem. Glad you got it working.