您的位置:首页 > 编程语言 > PHP开发

手动编译PHP

2015-10-13 09:25 525 查看
如何将php安装位apache的模块

获取安装文件: http://www.php.net/downloads.php php-5.3.8.tar.gz

tar xf php-5.4.13 -C /usr/local

cd /usr/local/php-5.4.13

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-config-file-path=/etc/ --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts(最后一项如果是per类型不用加 如果是work或者event就加 httpd -M 可以查看)

注意:要想使用--with-mcrypt加密功能需要安装四个包:
mhash-0.9.2-6.el5.i386.rpm
mhash-devel-0.9.2-6.el5.i386.rpm

libmcrypt-2.5.7-5...

libmcrypt-devel....

注意:rpmfind.net 可以下载各种rpm包 rpm -ivh *.rpm就可以安装
注意:将:--with-apxs2=/usr/local/apache2/bin/apxs改为--enable-fpm 表示启用fpm功能
即fastcgi格式
5.cd /usr/local/php...
cp php.ini-production 服务器端 /etc/php.ini
6.找到httpd的配置文件 找到AddType 添加两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
7.再找到DirectoryIndex目录主页面
改为DirectoryIndex index.php index.html

8../apachectl -f /usr/local/apache2/conf/httpd.conf -k start 启动起来
9.cd /usr/local/apache2/htdocs mv index.html index.php

10.vim index.php
<?php
$conn=mysql_connect('localhost','root','');
if ($conn)
echo "Success...";
else
echo "Failure...";
?>

service iptables stop
测试成功
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql 如何 local