環境:centos x64 最小化安裝
php版本:php-5.4.3
安裝前.先安裝些軟體和庫檔案
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
在這一步,遇到如下錯誤:
configure: error: xml2-config not found. please check your libxml2 installation.
解決辦法是:
yum install -y libxml2-devel
還有錯誤:
configure: error: cannot find openssl's
解決辦法是:
yum install -y openssl openssl-devel
錯誤:checking for bzip2 in default path... not found
configure: error: please reinstall the bzip2 distribution
解決辦法:
yum install -y bzip2 bzip2-devel
錯誤:configure: error: png.h not found.
解決辦法:
yum install -y libpng libpng-devel
錯誤:configure: error: freetype.h not found.
解決辦法:
yum install -y freetype freetype-devel
錯誤:configure: error: mcrypt.h not found. please reinstall libmcrypt.
解決辦法:
yum install -y epel-release
yum install -y libmcrypt-devel
因為 centos6 預設的 yum 源沒有 libmcrypt-devel 這個包,只能借助 epel 的 yum 源。
configure: error: jpeglib.h not found.錯誤
安裝
yum install libjpeg-devel
進入php的解壓目錄
./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt=/usr/local/libmcrypt --with-zlib --enable-mbstring --with-openssl --with-mysql --with-mysqli --with-mysql-sock --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --enable-pdo --with-pdo-mysql --with-gettext --with-curl --with-pdo-mysql --enable-sockets --enable-bcmath --enable-xml --with-bz2 --enable-zip --enable-freetype
執行之後遇到的問題:
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
這是ssl沒裝
解決辦法
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 /include/curl/
curl和curl庫檔案沒有安裝
解決辦法
yum install libcurl.x86_64 libcurl-devel.x86_64 -y
error 5
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.
(編譯安裝 ./configure --piefix=/usr/local/libmcrypt make && make install)
部分來至:
lamp環境只編譯安裝php
linux上yum安裝apache和mysql的源更新都較快,但php版本往往比較低。所以往往有需求yum安裝apache和mysql,然後編譯安裝php。這個思路就在於不使用yum安裝php,需要手動指定apxs的路徑。補充知識 apxs是乙個為apache http伺服器編譯和安裝擴充套件模組的...
手動編譯安裝lamp之php
馬哥教育講課文件 三 編譯安裝php 5.4.8 1 解決依賴關係 請配置好yum源 可以是本地系統光碟 後執行如下命令 yum y groupinstall x software development libmcrypt 2.5.7 5.el5.i386.rpm libmcrypt devel ...
編譯安裝lamp
1,停止防火牆及不必要的服務 etc init.d rpcbind stop etc init.d cups stop etc init.d postfix stop etc init.d qpidd stop etc init.d nfslock stop chkconfig rpcbind of...