Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    1

    Default How to modify PHP.ini? (register_globals problem)

    Hello,

    I installed oscommerce on a hosting account on my server (I do have access to WHM & Cpanel of that account). After complete installation, it gives following error when I open the oscommerce URL on that account:

    Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.


    Can anybody help me in editing this PHP.ini file?

    I read on some website that you should write the following line: register_globals = On into a file and name it php.ini and upload it to public_html or the directory in which script is located. I tried this too, but it doesn't help.

    When I opened htaccess file, it has the following stuff written into it:

    <IfModule mod_setenvif.c>
    <IfDefine SSL>
    SetEnvIf User-Agent ".*MSIE.*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
    </IfDefine>
    </IfModule>

    # If Search Engine Friendly URLs do not work, try enabling the
    # following Apache configuration parameter
    #
    # AcceptPathInfo On

    # Fix certain PHP values
    # (commented out by default to prevent errors occuring on certain
    # servers)
    #
    <IfModule mod_php4.c>
    php_value session.use_trans_sid 0
    php_value register_globals 1
    </IfModule>
    Can anybody help me? How can I get rid of this register_globals problem?

  2. #2
    Member
    Join Date
    Mar 2004
    Posts
    12

    Default PHP.ini => Register_globals Problem

    Hi,

    you cann edit the httpd.conf file:

    /usr/local/apache/conf/httpd.conf:

    look for the Section Virtual-Host of the Domain and add the Bold line - save the File and restart Apache

    <VirtualHost your IP>
    ServerAlias www.domain.tld domain.tld
    ServerAdmin webmaster@domain.tld
    DocumentRoot /home/username/public_html
    BytesLog domlogs/domain.tld-bytes_log
    User username
    Group usergroup

    <IfModule mod_php4.c>
    php_admin_value register_globals 1
    </IfModule>

    <IfModule mod_php5.c>
    php_admin_value register_globals 1
    </IfModule>

    <IfModule mod_userdir.c>
    UserDir disabled
    UserDir enabled username
    </IfModule>
    ServerName www.domain.tld
    ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
    User reiki
    Group reiki
    CustomLog domlogs/domain.tld combined
    </VirtualHost>

    Regards

    G. Barbez

  3. #3
    cix
    cix is offline
    Member
    Join Date
    Nov 2003
    Posts
    75

    Default

    Quote Originally Posted by anka
    Hi,

    you cann edit the httpd.conf file:

    /usr/local/apache/conf/httpd.conf:

    look for the Section Virtual-Host of the Domain and add the Bold line - save the File and restart Apache

    <VirtualHost your IP>
    ServerAlias www.domain.tld domain.tld
    ServerAdmin webmaster@domain.tld
    DocumentRoot /home/username/public_html
    BytesLog domlogs/domain.tld-bytes_log
    User username
    Group usergroup

    <IfModule mod_php4.c>
    php_admin_value register_globals 1
    </IfModule>

    <IfModule mod_php5.c>
    php_admin_value register_globals 1
    </IfModule>

    <IfModule mod_userdir.c>
    UserDir disabled
    UserDir enabled username
    </IfModule>
    ServerName www.domain.tld
    ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
    User reiki
    Group reiki
    CustomLog domlogs/domain.tld combined
    </VirtualHost>

    Regards

    G. Barbez
    This works on php CGI(cpanel default) and phpsuexec enabled?

  4. #4
    Member
    Join Date
    Mar 2004
    Posts
    12

    Default

    Hi

    its works on PHP as Module - I not Sure if et works on PHPCGI and phpsuexec.

    Regards

    G. Barbez

  5. #5
    Member
    Join Date
    Oct 2003
    Posts
    147

    Default

    Maybe help someone:

    If you have php4 and php5 both as PDO and you want example enable register_globals with .htaccess put

    php5_flag register_globals On (Off)
    php4_flag register_globals On (Off)

    Normaly php_flag register_globals Off will work only for one version of PHP not for both.

  6. #6
    cPanel Partner NOC cPanel Partner NOC Badge rking's Avatar
    Join Date
    Aug 2005
    Posts
    192

    Default

    If you're running PHP as an Apache module, you can set the php_flags as previously noted in this thread.

    If you're running PHP as CGI, you will need to remove the directives from your .htaccess or httpd.conf and instead place them within a php.ini file within the script's executing directory.

    If you have root access and want to make the change server-wide, you would edit the server's default php.ini.

    You would remove the php_flag directive and instead use only the variable you want to change. For example:

    Code:
    register_globals = On

  7. #7
    Member
    Join Date
    Apr 2003
    Location
    Auckland, New Zealand
    Posts
    172

    Default

    We've just finished upgrading servers to Apache2.2, PHP5 & MySQL 5. Lots of sites on the servers were having the same RG problem. PHP was running with SuPHP & SuHosin.

    We got round the problem by creating the php.ini file & placing one in the public_html, catalog (whatever they named the oscommerce folder) and the admin folder. All sites started working no problem. You'll also find that the includes/configure.php will need it permissions changed & depending on which version of oscommerce you have or they have you'll need to tweak some of the code, not much but oscommerce's forum is well documented.

    Ideally if it's an older version you would upgrade to the latest & most secure

  8. #8
    Member kran's Avatar
    Join Date
    Jul 2003
    Location
    Colombia
    Posts
    75

    Default This is what I do.

    I just create a php.ini with the following:

    register_globals = On
    allow_url_fopen = On
    safe_mode = Off

    Place it in the main oscommerce directory and chown it as the site user.
    www.americandominios.com
    hosting Colombia - LatinAmerica

  9. #9
    Member
    Join Date
    Oct 2003
    Posts
    147

    Default

    I run php5 dso and php4 cgi. PHP4 cgi have register_globals set Off i put php.ini to public_html with register_globals = On and run phpinfo.php4 and still see register_globals Off - why?

  10. #10
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by hekri View Post
    I run php5 dso and php4 cgi. PHP4 cgi have register_globals set Off i put php.ini to public_html with register_globals = On and run phpinfo.php4 and still see register_globals Off - why?
    This documentation may help: http://www.cpanel.net/support/docs/e..._requests.html

  11. #11
    Member
    Join Date
    Nov 2006
    Posts
    6

    Default

    Quote Originally Posted by cPanelDavidG View Post
    I have read it but i still get problem i have 3 server n i got same problem. my user can't modify php conf with their own php.ini.

    I tried all ways for compiling Apache+PHP4+PHP5 with Easy Apache but i still get wrong.

    And everything that sent by $_POST[] the PHP page can't display the value.

    Please some body help me. I had work for 1 week but i get nothing. Same problem again.


    I hope my user can modify their own php.ini

  12. #12
    cPanel Partner NOC cPanel Partner NOC Badge rking's Avatar
    Join Date
    Aug 2005
    Posts
    192

    Default

    Ahlul,

    The easiest way to see whether the settings you are changing are actually taking effect is to create a phpinfo file within the same directory as the php.ini you are using to change settings. Simply create a file named 'phpinfo.php' and put this code in it:

    Code:
    <?php phpinfo(); ?>
    Then visit the page in a browser. You can search the page for the particular setting, say register_globals, and see if it is being set.

  13. #13
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    The last time I tested this, one needed to use mod_suphp to get the behavior you want.

Similar Threads & Tags
Similar threads

  1. PHPSuexec and Register_globals / php.ini?
    By Ralph9110 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 04-20-2007, 12:52 AM
  2. TIP: PHP 5.1.6 + phpsuexec + local php.ini (register_globals)
    By Bazer in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-13-2007, 03:25 PM
  3. PHP Version 4.4.2, register_globals ON php.ini no longer works!
    By sh4ka in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-02-2006, 04:06 PM
  4. Replies: 7
    Last Post: 02-02-2006, 05:51 PM
  5. HELP::::::register_globals is disabled in php.ini
    By serverptx in forum cPanel and WHM Discussions
    Replies: 11
    Last Post: 11-27-2005, 05:46 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube