Author Topic: Invalid command 'php_flag'  (Read 9097 times)

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Invalid command 'php_flag'
« on: September 24, 2007, 10:35:02 PM »
[Tue Sep 25 02:22:00 2007] [alert] [client xxx.xxx.xxx.xxx] /home/tekoneho/public_html/roundcube/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration

i use WHB as a host. what am i doing wrong? i never had this issue on my old host.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,533
    • http://SKaero.com/
Re: Invalid command 'php_flag'
« Reply #1 on: September 24, 2007, 11:41:24 PM »
Ok try deleting your .htaccess file that should fix it.

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #2 on: September 25, 2007, 01:07:22 AM »
i did, now it comes up as a blank page :(

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,533
    • http://SKaero.com/
Re: Invalid command 'php_flag'
« Reply #3 on: September 25, 2007, 01:58:38 AM »
Ok make a new .htaccess file that looks like this:
Code: [Select]
# AddDefaultCharset UTF-8
php_value error_log logs/errors
php_value upload_max_filesize 2M

<FilesMatch &quot;(\.inc|\~)$|^_&quot;>
 Order allow,deny
 Deny from all
</FilesMatch>

Order deny,allow
Allow from all

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #4 on: September 25, 2007, 09:17:27 AM »
back to the 500 internal server error

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,533
    • http://SKaero.com/
Re: Invalid command 'php_flag'
« Reply #5 on: September 25, 2007, 05:57:26 PM »
Ok edit the .htaccess file to looks like this:
Code: [Select]
# AddDefaultCharset UTF-8
php_value error_log logs/errors
php_value upload_max_filesize 2M

Order deny,allow
Allow from all

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #6 on: September 25, 2007, 06:06:42 PM »

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,533
    • http://SKaero.com/
Re: Invalid command 'php_flag'
« Reply #7 on: September 25, 2007, 06:22:18 PM »
Are there any errors in the server error log?

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #8 on: September 26, 2007, 12:25:08 AM »
I submitted a ticket to my server admin and this is what I got back... this ran on my old provider just fine...

Dear Customer,

We hope, this information can help you:

Under the old Apache Module mode it was possible to manipulate the PHP settings from within a ".htaccess" file placed in the script's top-level directory, this was also recursively applied to all other directories below it.

 For example you could turn on the php setting "magic_quotes_gpc" with this line in .htaccess:

  php_value magic_quotes_gpc on

Now, when PHP is running as a CGI and phpSuExec protected, manipulating the PHP settings is still possible however you can no longer make use of a ".htaccess" file. Using .htaccess with the required PHP prefix of "php_value" will cause a "500 internal server error" when attempting to access the scripts. This is due to php no longer running as an Apache module, thus Apache is unable to handle those directives any longer.

If your host has, or is, implementing phpSuExec, ALL php values should be removed from your .htaccess files to avoid the 500 internal server error. Instead, you will now be creating and using your own "Local php.ini" file to manipulate the desired php settings.

What is a php.ini file?
The php.ini file is a configuration file that the server looks at to see what PHP options have been made available to the server or what their setting are, if different from the server's default php.ini. While the name may seem advanced to those unfamiliar with it, it is in essence a simple text file with the name php.ini

How to create a php.ini file
To create a php.ini file, just open up a text editor, add in the lines you need and save the file. You can name the file whatever you wish when saving, to ensure the correct FTP transfer mode is used, you might wish to name it "php.ini.txt". Once you have configured all your settings, upload the file to the directory where your script is located and then rename it back to php.ini

 For example you can turn on the php setting "magic_quotes_gpc" with this line in php.ini:

  magic_quotes_gpc = on

In many cases, you might need to have multiple copies of the same php.ini file in different directories, unlike .htaccess files, php.ini files are not applied recursively to lower directories. If you need the same functionality across all lower directries also, you will then need to copy the php.ini file each directory in turn that will have .php scripts running from within them.

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #9 on: September 26, 2007, 12:25:54 AM »
[Wed Sep 26 04:19:05 2007] [alert] [client xxx.xxx.xxx.xxx] /home/tekoneho/public_html/roundcube/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,533
    • http://SKaero.com/
Re: Invalid command 'php_flag'
« Reply #10 on: September 26, 2007, 01:37:32 AM »
Ok that help a lot, lets see if we can get it right this time!

Ok make a new file in roundcube's root called php.ini with the following code in it:
Code: [Select]
display_errors Off
log_errors On
error_log logs/errors
upload_max_filesize 2M

Also a .htaccess file with this code:
Code: [Select]
# AddDefaultCharset UTF-8


 Order allow,deny
 Deny from all


Order deny,allow
Allow from all
That should make it work, I hope!

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #11 on: September 26, 2007, 02:35:46 AM »
PHP: Error parsing /home/xxxx/public_html/roundcube/php.ini on line 1

that's what i got in my error logs.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,533
    • http://SKaero.com/
Re: Invalid command 'php_flag'
« Reply #12 on: September 26, 2007, 02:59:57 AM »
Ok I think I found your problem in your php.ini you put:
Code: [Select]
<php?
log_errors On
error_log logs/errors
upload_max_filesize 2M
?>

You only need
Code: [Select]
log_errors On
error_log logs/errors
upload_max_filesize 2M

No php tags are needed.

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #13 on: September 26, 2007, 09:11:08 AM »
no, i added those out of desperation. i had the same result moved to line 2 when added.

Offline tekone

  • Jr. Member
  • **
  • Posts: 27
Re: Invalid command 'php_flag'
« Reply #14 on: September 26, 2007, 09:42:09 AM »
i was told my server uses phpsuexec

how do i get around this?