编译PHP

11 篇文章 0 订阅

在此之前,我已经安装了apache,mysql,以及一些组件,

包括autoconf, automake, bison, cmake,  libjpeg, libpng, libmcrypt, libxml, mcrypt, mhash, ncurses, zlib.


打算编译安装PHP的主题和已知插件,其他需要的,到时侯需要用的时候再说吧。


]# ./configure --prefix=/usr/lib/php

--with-apxs2=/usr/local/apache2/bin/apxs     

--with-mysql-sock=/usr/lib/mysql/data/mysql.sock  

--with-mysql

--enable-xml --with-mcrypt --with-ttf --enable-magic-quotes --enable-fastcgi --enable-mbstring --enable-sysvsem

--with-iconv --enable-mbstring --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir 


编译提示说找不到mcrypt,

错误信息:configure: error: mcrypt.h not found. Please reinstall libmcrypt

我确认已经安装mcrypt和libmcrypt,位置在/usr/lib,所以给出位置吧:--with-mcrypt=/usr/lib


编译参数:

./configure --prefix=/usr/lib/php

--with-apxs2=/usr/local/apache2/bin/apxs    

--with-mysql-sock=/usr/lib/mysql/data/mysql.sock  

--with-mysql 

--enable-xml --with-mcrypt=/usr/lib --with-ttf --enable-magic-quotes --enable-fastcgi --enable-mbstring

--with-iconv --enable-mbstring --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-sysvsem


再次运行,又提示:configure: error: Cannot find libmysqlclient under /usr.

我的mysql安装在/usr/lib/mysql下面,发现/usr/lib/mysql/lib目录,进去找了下发现一堆这个名字的文件,

.so,.so.18,失身么玩意我还不知到。

反正是有的。只是系统没有找到。系统在usr下面找当然找不到。

我给出mysql目录地址好了,--with-mysql=/usr/lib/mysql 。


再次修改编译参数

./configure --prefix=/usr/lib/php

--with-apxs2=/usr/local/apache2/bin/apxs     

--with-mysql-sock=/usr/lib/mysql/data/mysql.sock  

--with-mysql=/usr/lib/mysql 

--enable-xml --with-mcrypt=/usr/lib --with-ttf --enable-magic-quotes --enable-fastcgi --enable-mbstring

--with-iconv --enable-mbstring --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-sysvsem

OK 这个问题解决了



但是又有了新的问题,

Notice: Following unknown configure options were used:

       --with-ttf
       --enable-fastcgi

Check './configure --help' 


不知道这两个东西是什么,反正暂时用不上,先删除掉吧。fastcgi好像听说过,现在也不需要。

编译参数:

./configure --prefix=/usr/lib/php

--with-apxs2=/usr/local/apache2/bin/apxs    

--with-mysql-sock=/usr/lib/mysql/data/mysql.sock 

--with-mysql=/usr/lib/mysql 

--enable-xml --with-mcrypt=/usr/lib --enable-magic-quotes  --enable-mbstring

--with-iconv --enable-mbstring --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --enable-sysvsem

OK编译安装成功



最后一步,一定要在httpd.conf里面添加php类型

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddType application/x-httpd-php .php
AddOutputFilter INCLUDES .shtml


然后再重启httpd服务即可




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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值