Learning how to create htaccess file in php is not possible as the .htaccess file can be used to control a number of PHP settings. Htaccess files are actually distributed configuration files and allow you to make a number of configuration changes on a directory basis. This means that you have the ability to have a different configuration for each directory of your website making it a very useful.
Through a .htaccess file you have the ability to set any php.ini values and it is very simple to do. This is also an option if your web host does not allow modification of the default php.ini file.
The standard syntax to be placed in the .htaccess file to adjust php_values is as follows:
php_value setting_name setting_value
Additionally, for on or off adjustments php_flag can be used:
php_flag setting_name on_off
The below examples show how the above standard syntax can be used for any PHP settings. This is not a complete list as there many settings that are not covered below. Also in the below examples you can update the values or flags to what you require for your specific instance.
Max Execution Time
php_value max_execution_time 30
Display PHP Errors
php_flag display_errors on
Maximum PHP File Upload Size
php_value upload_max_filesize 16M
php_value post_max_size 18M
PHP Script Memory Limit
php_value memory_limit 100M
Maximum Number of PHP Input Variables
php_value max_input_vars 1000
Mike is the managing member at MSLtek and is an avid web consultant and web developer. He enjoys solving complex problems and building awesome stuff.