mod_rewrite 正在我的系統上運行,但 apache2 error_logs 中仍然有錯誤。
me@server:# ls /etc/apache2/mods-enabled | grep rewrite
rewrite.load
rewrite.load的內容
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
錯誤日誌
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mod_rewrite.so.' - /usr/lib/php5/20090626/mod_rewrite.so.: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mod_rewrite.so.' - /usr/lib/php5/20090626/mod_rewrite.so.: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mod_rewrite.so.' - /usr/lib/php5/20090626/mod_rewrite.so.: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mod_rewrite.so.' - /usr/lib/php5/20090626/mod_rewrite.so.: cannot open shared object file: No such file or directory in Unknown on line 0
我將檔案 mod_rewrite 複製到該資料夾/usr/lib/php5/20090626/,檢查文件是否存在:
-rwxr--r-- 1 root root 63488 Mai 4 17:41 /usr/lib/php5/20090626/mod_rewrite.so
並重新啟動 apache2 但仍然出現相同的錯誤。任何想法?
答案1
mod_rewrite
是一個 Apache 模組,但根據您發布的錯誤訊息,看起來您必須有一個php.ini
類似於以下內容的條目:
extension=/usr/lib/php5/20090626/mod_rewrite.so.
PHP 無法載入 mod_rewrite 作為擴展,也表示引用的檔案不存在。
在 php.ini 中找到嘗試載入擴展 mod_rewrite 的行並將其刪除,日誌訊息就會消失。