php_flag and php_value errors, and how to fix it.

Problem:
You are seeing Internal Server Errors in your browser when you view your web site.

You have recently added items to your .htaccess file that contain php_flag and/or php_value directives.

Example Errors:
Example items in your cPanel error log (cPanel > Error log) will be like:

Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration

Reason:
The script you are using assumes that PHP is installed as a module. PHP is installed as a CGI on our servers. Your script should have documentation for how to install it on servers that run PHP as a CGI. This is sometimes referred to as PHP SuExec or SuPHP.

Solution:
Instead of adding these directives to your .htaccess file, add them into a file called php.ini and place this file in the same directory that your script runs in. Most often this will be public_html, but in some cases you will install your script in a subdirectory. Wherever your script runs, this is the place for your php.ini file. You will need to drop the "php_flag" and "php_value" prefix. You will also need to put an equals (=) sign between the setting and the value.

For example, if your script recommends these settings in a .htaccess file:

 

Code:
php_flag register_globals off
php_flag magic_quotes_gpc off
php_value safe_mode off

Put them in a php.ini file instead. Here is the proper syntax:

 

Code:
register_globals = off
magic_quotes_gpc = off
safe_mode = off
  • 52 Users Found This Useful
Was this answer helpful?

Related Articles

What is the path to public_html?

The full system path to public_html is:/home/username/public_html'username' is your cPanel username

What to do if your WordPress site is hacked

Why is my site hacked?Why is my site hacked? What should I do now?A web site is usually hacked...

Jika anda pengguna VPS, ini adalah cara mudah menukar DNS Shoppegram secara pukal

Sekiranya anda miliki VPS (atau server), dan ingin pointkan domain anda ke Shoppegram, sila ikut...

What are your DNS Nameserver details?

Please refer to your Welcome email that contains your username and password that you received...

How to redirect HTTP to HTTPS using htaccess

The below code when added to an .htaccess file will automatically redirect any traffic destined...