Using php_flag or php_value in .htaccess files

The "php_value" or "php_flag" commands in .htaccess files are recommended by PHP scripts. Here is an example of them:

    php_value  include_path         ".:/usr/local/lib/php"
    php_flag   display_errors       Off
    php_value  upload_max_filesize  2M

Here is the list of PHP values that you can change using .htaccess

======================================
php_flag session.use_trans_sid On
php_flag session.use_only_cookies on
php_flag register_globals On
php_value magic_quotes_runtime On
php_flag magic_quotes_gpc off
php_admin_flag safe_mode Off
php_value post_max_size 2048
php_value upload_max_filesize 15M
php_value memory_limit 128M
php_value max_execution_time 300
php_value magic_quotes_gpc off
php_flag session.bug_compat_warn off
php_value session.use_cookies 1
php_flag session.use_only_cookies 1


Please note that you can't use "php_value" or "php_flag" commands in .htaccess files. If you do it, an "internal server error" message will be displayed.

Another way to have the same effect is by modifying of php.ini file. It’s flexible and through it you can override many PHP settings as opposed to .htaccess files.

You can look for PHP support page, where will find more instructions on modifying php.ini. It’s necessary to add the following lines to your custom php.ini file in order to have the same effect as the .htaccess lines above:

    include_path = ".:/usr/local/lib/php"
    display_errors = Off
    upload_max_filesize = 2M

Was this answer helpful?

 Print this Article

Also Read

How to stop LiteSpeed Server Cache

To stop Lite Speed Enterprise Webaserver cache enter in .htaccess RewriteEngine OnRewriteRule...

What Is the Difference between Domains vs. Hosting vs. Website?

Let’s look at the process that happens when somebody goes to the web browser and enters your...

How to Unban from Firewall

1. Go to Services Menu2. Click on Hosting Service Status button3. At the bottom left menu there...

Different Types of Web Hosting Plans

A web hosting service is a type of Internet hosting service. It allows everyone to make website...

What does "Unlimited Domains" mean?

The phrase "unlimited domains" is used widely and regularly in web hosting, but what does it...