安装php后启动apache报错
时间:2006-11-04 来源:UIRL
安装php5.1.6后,启动apache报如下错误:
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
[root@localhost bin]# vi /usr/local/apache/conf/httpd.conf
在网上查询后,据称是Linux有一个SELinux保护模式引起的。找到如下解决方式:
chcon /usr/local/apache/modules/libphp5.so -t shlib_t
chcon的用法如下:
chcon --help
Usage: chcon [OPTION]... CONTEXT FILE...
or: chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
or: chcon [OPTION]... --reference=RFILE FILE...
Change the security context of each FILE to CONTEXT.
-c, --changes like verbose but report only when a change is made
-h, --no-dereference affect symbolic links instead of any referenced file
(available only on systems with lchown system call)
-f, --silent, --quiet suppress most error messages
--reference=RFILE use RFILE's group instead of using a CONTEXT value
-u, --user=USER set user USER in the target security context
-r, --role=ROLE set role ROLE in the target security context
-t, --type=TYPE set type TYPE in the target security context
-l, --range=RANGE set range RANGE in the target security context
-R, --recursive change files and directories recursively
-v, --verbose output a diagnostic for every file processed
--help display this help and exit
--version output version information and exit
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
[root@localhost bin]# vi /usr/local/apache/conf/httpd.conf
在网上查询后,据称是Linux有一个SELinux保护模式引起的。找到如下解决方式:
chcon /usr/local/apache/modules/libphp5.so -t shlib_t
chcon的用法如下:
chcon --help
Usage: chcon [OPTION]... CONTEXT FILE...
or: chcon [OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
or: chcon [OPTION]... --reference=RFILE FILE...
Change the security context of each FILE to CONTEXT.
-c, --changes like verbose but report only when a change is made
-h, --no-dereference affect symbolic links instead of any referenced file
(available only on systems with lchown system call)
-f, --silent, --quiet suppress most error messages
--reference=RFILE use RFILE's group instead of using a CONTEXT value
-u, --user=USER set user USER in the target security context
-r, --role=ROLE set role ROLE in the target security context
-t, --type=TYPE set type TYPE in the target security context
-l, --range=RANGE set range RANGE in the target security context
-R, --recursive change files and directories recursively
-v, --verbose output a diagnostic for every file processed
--help display this help and exit
--version output version information and exit
相关阅读 更多 +