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 的行并将其删除,日志消息就会消失。