配置apache 支持 php
2015-07-06 23:19
633 查看
在/etc/httpd/conf.d 下面加入php.conf
php.conf中内容如下:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
一直出现一个错误就是Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so:
cannot open shared object file: No such file or directory
解决方法:在/etc/httpd/modules/中加入libphp5.so即可
php.conf中内容如下:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
一直出现一个错误就是Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so:
cannot open shared object file: No such file or directory
解决方法:在/etc/httpd/modules/中加入libphp5.so即可
相关文章推荐
- 大约apache 2.4.X虚拟主机配置问题的版本号后,
- linux 源码安装apache2.4并添加服务
- linux系统下apache服务的启动、停止、重启命令
- Apache ab
- 在Windows的Apache服务器上配置对PHP和CGI的支持
- Apache服务器下防止图片盗链的办法
- 基于apache整合svn服务器,基于mysql对用户认证
- Apache配置虚拟文件夹
- Apache服务器中.htaccess的基本配置总结
- 给Apache虚拟主机增加端口的方法
- Windows系统下Apache服务器无法启动的问题解决
- Linux系统下操作Apache最基本的启动停止和重启命令
- Apache服务器中使用.htaccess实现伪静态URL的方法
- Apache中解决动态地址跳转死循环的方法
- Apache访问出现501 Method Not Implemented错误解决
- Apache的fork模式和worker模式判断方法
- Apache中使非伪静态url跳转到伪静态url的方法
- 在Apache服务器中运行CGI程序的方法
- 开发javaEE项目时出现java.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converter的错误
- 四大开源协议比较:BSD、Apache、GPL、LGPL