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

前端 未结 5 1409
忘掉有多难
忘掉有多难 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:57

    It depends on how PHP is installed on your server; if its installed as an apache module, then you'll use .htaccess files to issue PHP directives as .htacess is read and executed by Apache.

    If you run PHP as CGI, then you'll use a php.ini file, as anything in .htaccess woudln't affect your PHP.

    You can check how PHP is installed by making a php file with phpinfo(); it in.

    This only refers to local overrides for a specific directory; regardless of how PHP is installed it reads your main php.ini file.

提交回复
热议问题