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

【学习笔记】php的安装

2012-11-30 16:50 393 查看
安装环境:centos X64 6.0 已经编译完成 apache mysql
php版本:5.3.13
php安装依赖包:yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpef-devel freetype-devel libpng-devel gd-devel curl-devel libxslt libxslt-devel openssl-devel -y
还需要libiconv包
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxvf libiconv-1.14.tar.gz
./configutr --prefix=/usr/local/libiconvmake && make install
--------------------------------------------------------------
编译安装php:
./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql
--with-xmlrpc
--with-openssl
--with-zlib
--with-freetype-dir
--with-gd
--with-jpeg-dir
--with-png-dir
--with-iconv=/usr/local/libiconv
--enable-short-tags
--enable-sockets
--enable-zend-multibyte
--enable-soap
--enable-mbstring
--enable-static
--enable-gd-native-ttf
--with-curl
--with-xsl
--enable-ftp
--with-libxml-dir
适合nagios的php环境 解决msn robot “Call to undefined function pdntl_fork()”报错而加
--enable-sigchild
--enable-pcntl
--enable-bcmath
(方便复制:./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-xmlrpc --with-openssl --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv=/usr/local/libiconv --enable-short-tags --enable-sockets --enable-zend-multibyte --enable-soap --enable-mbstring --enable-static --enable-gd-native-ttf --with-curl --with-xsl --with-libxml-dir --enable-ftp --enable-sigchild --enable-pcntl --enable-bcmath)
编译安装完成后 需要到 apache的配置文件里面指定php首页
再到配置文件的311行左右添加
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
~~~~~~~~~~~~~~~~编译php的时候报错和解决方法~~~~~~~~~~~~~~~~~

error 1
checking for xml2-config path...

configure: error: xml2-config not found. Please check your libxml2 installation.
(看提示就明白 是一个lib库没装 先用 yum search 名字 看是否能搜到名字 ,找到名字后 把软件包 开发包装上)
解决办法
yum install libxml2-devel.x86_64
error 2
checking for pkg-config... /usr/bin/pkg-config

configure: error: Cannot find OpenSSL's <evp.h>

这是openssl没装
解决办法
yum install openssl.x86_64 openssl-devel.x86_64 -y

error 3
checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

这是bzip2软件包没有安装
解决办法
yum install bzip2-devel.x86_64 -y
error 4
configure: error: Please reinstall the libcurl distribution -

easy.h should be in <curl-dir>/include/curl/

curl和curl库文件没有安装
解决办法
yum install libcurl.x86_64 libcurl-devel.x86_64 -y
error 5
checking whether to enable JIS-mapped Japanese font support in GD... no

checking for fabsf... yes

checking for floorf... yes

configure: error: jpeglib.h not found

GD库没有安装
解决办法
yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y
error 6
checking for stdarg.h... (cached) yes

checking for mcrypt support... yes

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

libmcrypt库没有安装 ,要是不能用yun安装的话 就要去下载个gz包 自己编译安装
(编译安装 ./configure --piefix=/usr/local/libmcrypt make && make install)
要是错误里面含有mysql的 那是mysql-devel 没有安装
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: