robbbert Posted January 12, 2007 Share Posted January 12, 2007 Hi, welcome to my thread, and, right-on: I did do a search (reading a bunch of answers asking for that). ;)Now, I've installed Apache 2.0 and PHP5 on Ubuntu Linux, and would like to install OSCommerce web shop, which requires register_globals to be turned on (for the installation, at least).I've created a directory /var/www/test, and put there two files:test.php:[code]<?phpecho ini_get("register_globals");?>[/code] and .htaccess:[code]<IfModule mod_php5.c> php_flag register_globals on php_flag register_long_arrays on php_value default_charset UTF-8</IfModule>[/code]If it makes a difference, I've copied the .htaccess file to the /var/www directory, too.In both /etc/php5/cgi/php.ini and /usr/share/php5/php.ini-dist, I've changed [i]the line[/i] to[code]register_globals = On[/code]I've restarted the Apache.To no avail: echo ini_get("register_globals") still returns 0.Any tips, or letters of sympathy, at last?ThanksRobert Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/ Share on other sites More sharing options...
Jessica Posted January 12, 2007 Share Posted January 12, 2007 Why not just set it in the php.ini? Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159245 Share on other sites More sharing options...
redbullmarky Posted January 12, 2007 Share Posted January 12, 2007 doing it in the PHP.INI file would affect every site built on the server. applying register_globals as ON is highly unrecommended, so best to keep it to as few sites as possible...it'd be worth having a check for other php.ini files on your server. most of the hosts i've been with tend to have it tucked in /etc/php.ini[b]edit:[/b] failing that, in your test file, put: phpinfo() , which should reveal the path of the php.ini file that's currently being used. Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159254 Share on other sites More sharing options...
robbbert Posted January 12, 2007 Author Share Posted January 12, 2007 Thanks.[quote author=redbullmarky link=topic=122128.msg503279#msg503279 date=1168623690]phpinfo() , which should reveal the path of the php.ini file that's currently being used.[/quote]Good idea! - That's /etc/php5/apache2/php.ini, and I've set [i]register_globals = On[/i] there, too, and restarted Apache. Of course, I've also made sure the browser doesn't cache the page.After all, ini_get("register_globals") still returns 0... Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159294 Share on other sites More sharing options...
wildteen88 Posted January 12, 2007 Share Posted January 12, 2007 If OSCommerce requires register_globals to be on thne enable it for that script only. Don't enable it site wide. If I remember correctly OSCommerce should have an .htaccess file in the OSCommerce folder. Just edit that and add the following to it:[code]php_flag register_globals On[/code]OSCommerce should now work.Also php_flag or php_value will only work if PHP is loaded as an Apache module. They will not work if PHP is running in CGI mode. Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159297 Share on other sites More sharing options...
robbbert Posted January 12, 2007 Author Share Posted January 12, 2007 [quote]OSCommerce should now work.[/quote]I've added that line (but anything else) to <wwwroot>.htaccess, and put there a php file that only contains [i]echo ini_get("register_globals");[/i].Unfortunately, the problem persists.[quote]Also php_flag or php_value will only work if PHP is loaded as an Apache module.[/quote]That's explaining why there is a //cgi/php.ini as well as a //apache2/php.ini (in both, register_globals is turned [i]on[/i]).Moreover, PHP is loaded as Apache module: When I add [code]LoadModule php5_module /usr/lib/apache2/modules/libphp5.so[/code] to httpd.conf, Apache warns "[i]module php5_module is already loaded, skipping[/i]" when being started. Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159326 Share on other sites More sharing options...
robbbert Posted January 13, 2007 Author Share Posted January 13, 2007 This issue has been solved by adding the following line to httpd.conf:[code]PHPIniDir /etc/php5/apache2[/code]The location of the directory can be taken from [i]phpinfo() [/i]as mentioned before.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159876 Share on other sites More sharing options...
robbbert Posted January 13, 2007 Author Share Posted January 13, 2007 ... while I'm still wondering why the .htaccess file doesn't work ... ??? Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159878 Share on other sites More sharing options...
wildteen88 Posted January 13, 2007 Share Posted January 13, 2007 [quote author=robbbert link=topic=122128.msg503922#msg503922 date=1168687805]... while I'm still wondering why the .htaccess file doesn't work ... ???[/quote]Have you configured Apache to allow configuration overriding through .htaccess files?Look for the following in your httpd.conf:[code]# AllowOverride controls what directives may be placed in .htaccess files.[/code]After that it should have the [tt]AllowOverride[/tt] directive. Post what it is currently set to here. In order for .htaccess files to override the servers configuration the [tt]AllowOverride[/tt] directive must have atleast [tt]fileInfo[/tt] listed. Otherwise Apache will ignore .htaccess files. I usually set this directive to [tt]All[/tt], eg:[tt] AllowOverride All[/tt] Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-159899 Share on other sites More sharing options...
robbbert Posted January 14, 2007 Author Share Posted January 14, 2007 Thank you wildteen88.I'd played with AllowOverride in apache2.conf (not httpd.conf, BTW), I'd read the Apache docs, too -- nevertheless, it's not working, yet, but good to know where to proceed.Currently, I'm in an evaluation phase, only, (and really tired) so I'm just letting it be for now.Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/33921-my-very-first-php-question-register_globals/#findComment-160652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.