编译配置项
php需要的依赖包
yum -y install libmcrypt-devel mhash-devel libxslt-devel \ libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \ zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \ ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \ krb5 krb5-devel libidn libidn-devel openssl openssl-devel ./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt --enable-mbstring --with-curl \ --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib \ --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \ --with-mhash --enable-zip --with-pcre-regex --with-mysql=/usr/local/mysql \ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql --with-gd --with-jpeg-dir \ --with-png-dir --with-freetype-dir --with-openssl
问题一,没有找到lltdl 或者什么 mcrypt之内的不存在 这也是缺少库导致的
解决办法:
cd /usr/local/src wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz tar -zxvf libmcrypt-2.5.8.tar.gz cd /usr/local/src/libmcrypt-2.5.8 ./configure --prefix=/usr/local make make install cd /libmcrypt-2.5.8/libltdl/ ./configure --enable-ltdl-install make && make install
问题二,没有找到mysql_conf 或者说什么mysql.h没找到之内的两种方法。
1)sudo ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
将mysql_confi从你的安装目录链接到/usr/local/bin目录下,这样就可以在任意目录下访问了(也可以放到/usr/bin)
2)编辑源码文件夹的site.cfg文件,去掉#mysql_config = /usr/local/bin/mysql_config前的注释#,修改后面的路径为你的mysql_config真正的目录就可以了。(如果不知道mysql_config在哪里,运行命令:whereis mysql_config)
不推荐yum install mysql-devel
其他坑爹问题:
#libmysqlclient.so.18软链接
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64
#否则会发生错误
libtool: link: warning: library `/usr/local/lib/libmcrypt.la' was moved.
libtool: link: warning: library `/usr/local/lib/libmcrypt.la' was moved.
Generating phar.php
/usr/local/src/php-5.3.29/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] Error 127
#复制phar.phar文件
#否则会发生错误cp: cannot stat `ext/phar/phar.phar': No such file or directory
cp /usr/local/src/php-5.3.29/ext/phar/phar.php /usr/local/src/php-5.3.29/ext/phar/phar.phar
然后开始重新编译 php ok
原文链接:安装php5.3.29遇到的问题解决,转载请注明来源!