编译PHP
在此之前,我已经安装了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服务即可
页:
[1]