这是编译参数:其他的不需要 就没开。 Configure Command './configure' '--prefix=/usr/local/php' '--with-mysql-dir=/usr/share/mysql/' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/usr/local/lib' '--with-zlib' 页面显示: Fatal error: Call to undefined function mysql_connect() in /usr/local/apache2/htdocs/test/test.php on line 4phpinfo()信息中没有mysql。
checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for MySQL support... yes, shared checking for specified location of the MySQL UNIX socket... no checking for the location of libz... no checking for mysql_close in -lmysqlclient... no checking for mysql_errno in -lmysqlclient... no configure: error: Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.
extensions/no-debug-non-zts-20090626/hello.so 是你编译后的路径 一般成功编译后会有路径提示 给复制下来最后hello.so 要修改成mysql.soYou will need re2c 0.13.4 or later那你就去下个新的 wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download tar -zxvf re2c-0.13.5.tar.gz cd re2c-0.13.5 ./configure && make && make installTry adding --with-zlib-dir=<DIR>.这里 修改成 --with-zlib-dir=/usr/lib
--with-mysql=/opt/mysql/server-5.5/
注意编译php的时候加上mysql路径
如果是另外编译的 需要在php.ini增加上 mysql.so 不过我只对mysqli这么干过.
这是编译参数:其他的不需要 就没开。
Configure Command './configure' '--prefix=/usr/local/php' '--with-mysql-dir=/usr/share/mysql/' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/usr/local/lib' '--with-zlib'
页面显示:
Fatal error: Call to undefined function mysql_connect() in /usr/local/apache2/htdocs/test/test.php on line 4phpinfo()信息中没有mysql。
编译成功后,还有去改php.ini吗?
cp php.ini-development /usr/local/php/lib/php.ini
就这个完了以后。
当然啊 你自己单独编译了mysql这个扩展 那你就需要把扩展mysql.so给增加到你的php.ini配置文件里,然后再restart apache
把扩展mysql.so给增加到你的php.ini这步怎么操作的呀 ? 谢谢。
extension_dir = ".:/usr/nc-home/php5/include/php/ext:/usr/nc-home/php5/lib/php:/usr/local/lib/"
extension = /usr/nc-home/php5/lib/php/extensions/no-debug-non-zts-20090626/hello.so
在这文件里我试试看 谢谢
第二个目录下找不出这部分 extensions/no-debug-non-zts-20090626/hello.so
又哪里出问题了。
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for MySQL support... yes, shared
checking for specified location of the MySQL UNIX socket... no
checking for the location of libz... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_errno in -lmysqlclient... no
configure: error: Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.
wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download
tar -zxvf re2c-0.13.5.tar.gz
cd re2c-0.13.5
./configure && make && make installTry adding --with-zlib-dir=<DIR>.这里 修改成 --with-zlib-dir=/usr/lib