#./configure --prefix=/app/local/php --with-config-file-path=/app/local/php/etc --with-apxs2=/app/local/apache/bin/apxs --with-mysql --with-libxml-dir=/usr/local/libxml2 --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg6 --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd2 --with-zlib-dir=/usr/local/zlib --with-mcrypt=/usr/local/libmcrypt --with-mysqli --with-xpm-dir=/usr/lib64 --enable-soap --enable-mbstring=all --enable-sockets
#make && make install
#cd ../
#cp /usr/local/src/php-5.6.12/php.ini-production /app/local/php/etc/php.ini
#vi /app/local/php/etc/php.ini
找到;date.timezone
改为date.timezone=PRC
保存退出
配置apache解析php:
#vi /app/local/apache/conf/httpd.conf
找到;ServerName :80
改为ServerName localhost:80
找到:AddType application/x-gzip .gz .tgz
在该行下面添加:AddType application/x-httpd-php .php
找到DirectoryIndex index.html
改为:DirectoryIndex index.html index.htm index.php
找到User daemon Group daemon
注释后添加:User www
Group www
找到: Options Indexes FollowSymLinks
修改为:Options FollowSymLinks
找到:AllowOverride None
修改为:AllowOverride All
equire all granted
最后保存退出#/app/local/apache/bin/apachectl -t#测试httpd.conf 如果有错误,会有提示, 如果是正确的则显示为 “Syntax OK”
#/app/local/apache/bin/apachectl start
#ps -ef|grep httpd
root 12130 1259 0 15:49 pts/0 00:00:00 grep httpd
root 23172 1 0 14:13 ? 00:00:00 /app/local/apache/bin/httpd -k start
www 23173 23172 0 14:13 ? 00:00:02 /app/local/apache/bin/httpd -k start
www 23174 23172 0 14:13 ? 00:00:02 /app/local/apache/bin/httpd -k start
www 23175 23172 0 14:13 ? 00:00:02 /app/local/apache/bin/httpd -k start
说明已经启动
#vi /app/local/apache/htdocs/info.php
<?php
phpinfo();
?>
保存退出后在浏览器输入ip地址/info.php后检测是否成功
如图所示
下面关于LAMP相关的内容你可能也喜欢:
LAMP平台安装Xcache和Memcached加速网站运行
CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境
Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)开发环境