.htaccess php_value auto_prepend_file makes 500 error. How can I fix this?

前端 未结 2 934
迷失自我
迷失自我 2020-12-30 16:04

My .htaccess is as follows:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /school
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1
RewriteRule ^([a-zA-         


        
相关标签:
2条回答
  • 2020-12-30 16:39

    You could use htscanner PHP module if you want to use php_value in your .htaccess files when running php as a CGI/FastCGI application.

    0 讨论(0)
  • 2020-12-30 16:48

    Note: This information was taken nearly verbatim from another website, I thought it explained the issue well and I highly suspect this is the problem:


    Using php_flag or php_value in .htaccess files

    Some PHP scripts suggest using "php_value" or "php_flag" commands in .htaccess files, as in this example:

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

    However, some servers run PHP in "CGI mode" (not as an Apache module), so you can't use "php_value" or "php_flag" commands in .htaccess files. If you try to do so, you'll see an "internal server error" message.

    You can modify your php.ini file to get the same effect, though. In fact, modifying php.ini is actually more flexible than using php_value or php_flag: there are many things you can't override using .htaccess files, but you can override almost any PHP setting in the php.ini file.

    To get the same effect as the .htaccess lines above, you would simply add these lines to your custom php.ini file:

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

    Note: Some systems will require quotes around the paths, and some must not use quotes.

    0 讨论(0)
提交回复
热议问题