What is the difference between php.ini and .htaccess?

前端 未结 5 1408
忘掉有多难
忘掉有多难 2021-02-06 02:59

Assume if I want to change the value of

php_value post_max_size 20M in .htaccess

post_max_size 20M in php.ini

Both will do same operation. So

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-06 03:35

    The configuration in the php.ini is used for the whole server while the configuration in a .htaccess file is only used when a request goes to the directory or subdirectory the .htaccess file is located in.

    So you can have a global or default configuration in your php.ini and specific configurations for individual directories in .htaccess files. Furthermore web hosting provider often do not allow access to the php.ini or server configuration but do only allow .htaccess files.

    But notice the configuration modes every PHP configuration is bound to.

提交回复
热议问题