The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess php_flag command fail

Discussion in 'General Discussion' started by surapong, Aug 18, 2009.

  1. surapong

    surapong Member

    Joined:
    Aug 18, 2009
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hi ,

    I try to change global_register flag defaulted "off" on my web site by adding a statement "php_flag register_globals on " in .htaccess file, but the error "Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. " has shown on my web site, and also i found " .htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration " in error log file on my web site.

    Please anyone suggest on this one.


    Best Regards,
    Surapong
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    How are you running PHP: SuPHP, CGI, FastCGi, DSO (Apache Module) ?
     
  3. surapong

    surapong Member

    Joined:
    Aug 18, 2009
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Yes, I am running on suPHP.
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  5. linux7802

    linux7802 Well-Known Member

    Joined:
    Dec 14, 2007
    Messages:
    232
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Solution

    Yes basically following error message occur ".htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration" due to suPHP enabled on server due to that you can't define the php values in .htaccess file.But you can manage php values by by using php.ini file under each directory where you want.

    For example if you want to enable the register_globals for domain name test.com then you need to be create php.ini file under the public_html with the content "register_globals = On".It will enable the register_globals for that domains public_html folder only.

    If your script installed under the public_html i.e public_html/test folder which required the register_globals enabled then you also need to create new php.ini file with the content "register_globals = On" to enable it for the entire folder public_html/test. Because php.ini file is working on directory basis and each directory required its own php.ini file to change the php values.
     
  6. thewebhosting

    thewebhosting Well-Known Member

    Joined:
    May 9, 2008
    Messages:
    1,201
    Likes Received:
    1
    Trophy Points:
    38
    PHP flags and values (php_flag / php_value) can not be override from .htaccess file since you have suPHP enabled. Please follow the steps provided by linux7802 to get it working.
     
  7. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Linux7802 is partially correct in that you do need a custom PHP.INI file to override PHP settings but the instructions they gave you pertain to phpSuExec and not to SuPHP which actually operates a bit differently.

    Click here for more information on setting up custom PHP.INIs under SuPHP.

    Now addressing the broader issue, as you have already found out, any
    attempt to insert "PHP_FLAG" or "PHP_VALUE" commands in .htaccess
    when running PHP as SuPHP will trigger an Error 500 condition for your site
    and the only way you can override PHP commands is via a custom PHP.INI
    using the suPHP_ConfigPath command or with PHP's ini_set() function.
     
Loading...

Share This Page