执行下面语句:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-libdir=lib64(警告)
报错:
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
configure: error: Cannot find libmysqlclient under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!
[root@m php-5.5.25]# php -v
-bash: php: command not found
重新编译:
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear (去掉)--with-libdir=lib64参数
成功如下:
Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: WARNING: unrecognized options: --enable-discard-path, --enable-safe-mode, --with-curlwrappers, --enable-fastcgi, --enable-force-cgi-redirect
[root@m php-5.5.25]#
编译成功有警告。
解决问题思路:
参考:
I had to up-grade on MySQL server to 5.5 on last week in a server. Developers are accessing this server over the PhpMyAdmin url. This the server was configured with the php yum version which shipped with the OS. PhpMyAdmin was crashed once after I up-graded the MySQL. It’s showing the following errors.
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
I see that MySQL package integrity has been lost after the up-gradation (I removed the default MySQL installs prior to this). Hence the ‘yum php’ will not work afterwards. So I’m planning to install PHP manually after remove all the php package using yum. Download the source file from php.net and installing. When I execute “./configure” command returns mysql ibrary error.
Solution
You have to include “–with-libdir=lib64″ in config. parameters to get it work.
The following additional actions to be done for proper installation on 64 bit platform.
1. You might need to remove/rename the file Php-Apache library file “/usr/lib64/httpd/modules/libphp5.so” before executing “make install”
2. You may need to install MySQL libraries ie #yum install mysql-devel
3. Set php extension directory path in ‘/etc/php.ini’ to “/usr/lib64/php/modules”
extension_dir = “/usr/lib64/php/modules”
Then restart the web server to get it run. It’s the second time I got the same error even I remembered it had came earlier but I did not pick up the solution on time which is so sad…
-njoy -)