编译安装hph

一、安装相关的依赖:

yum -y install gcc gcc-c++ bzip2-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel

 

二、解压php安装包php-5.6.22.tar.gz

tar -xzvf php-5.6.22.tar.gz -C/usr/src/

 

三、编译安装php

cd /usr/src/php-5.6.22/
./configure --prefix=/usr/local/php5.6/ --with-config-file-path=/usr/local/php5.6/etc --with-config-file-scan-dir=/usr/local/php5.6/etc/php.d --with-mysql=/usr/local/mysql/ --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --enable-bcmath --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/httpd/bin/apxs  --with-bz2 --enable-maintainer-zts --with-gd --with-gettext && make && make install

 

四、查看模块的php是否安装成了httpd的模块

ll /usr/local/httpd/modules/ | grep --color php

 

五、复制php的配置文件

cp /usr/src/php-5.6.22/php.ini-production /usr/local/php5.6/etc/php.ini

 

六、修改httpd的配置文件使httpd能处理php文件

vim /usr/local/httpd/conf/httpd.conf
增加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

修改
DirectoryIndex index.php index.html

 

七、制做一个首页文件index.php用于测试php是否安装成功

mv /usr/local/httpd/htdocs/index.html /usr/local/httpd/htdocs/index.php

vim /usr/local/httpd/htdocs/index.php
<html>
<head>
</head>
<body>
<?php 
phpinfo();
?>
</body>
</html>

 

八、启动httpd并查看php页面是否生效

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值