linux 下 php的mysql扩展编译成功 显示mysql support yes 下面一切顺利  但是页面上却call undefined function mysql_connect 
phpinfo()中依然没有 mysql 怎么回事啊?大家们

解决方案 »

  1.   

    php.ini配置文件中开启 mysql相关扩展了没?
      

  2.   

    不知道你怎么编译的
    --with-mysql=/opt/mysql/server-5.5/ 
    注意编译php的时候加上mysql路径
    如果是另外编译的 需要在php.ini增加上 mysql.so 不过我只对mysqli这么干过.
      

  3.   


    这是编译参数:其他的不需要 就没开。
    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。
      

  4.   


    编译成功后,还有去改php.ini吗?
     cp php.ini-development /usr/local/php/lib/php.ini
    就这个完了以后。
      

  5.   


    当然啊 你自己单独编译了mysql这个扩展 那你就需要把扩展mysql.so给增加到你的php.ini配置文件里,然后再restart apache
      

  6.   


    把扩展mysql.so给增加到你的php.ini这步怎么操作的呀 ? 谢谢。
      

  7.   

    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
      

  8.   

    cp php.ini-development /usr/local/php/lib/php.ini
    在这文件里我试试看 谢谢
      

  9.   


    第二个目录下找不出这部分 extensions/no-debug-non-zts-20090626/hello.so
    又哪里出问题了。
      

  10.   

    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.
      

  11.   

    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
      

  12.   

    谢谢 大家 可以了 就是没把mysql.so加上的原因 学习了 ....