php GD library error in ubuntu

后端 未结 4 1951
面向向阳花
面向向阳花 2021-02-07 02:11

I am using ubuntu 11.04 and when I am opening terminal and typing php -a it is showing some error like this

PHP Warning:  PHP Startup: Unable to lo         


        
4条回答
  •  心在旅途
    2021-02-07 02:51

    For me the solution was:

    locate --regex /mcrypt[.]so\$ /gd[.]so\$ /suhosin[.]so\$ /pdo_mysql.so\$ /pdo[.]so /mysqli[.]so\$ '/php5/.*/mysql[.]so$'
    

    Which returned the location of all the libraries that my php5 install was having trouble finding:

    /usr/lib/php5/20090626+lfs/gd.so
    /usr/lib/php5/20090626+lfs/mcrypt.so
    /usr/lib/php5/20090626+lfs/mysql.so
    /usr/lib/php5/20090626+lfs/mysqli.so
    /usr/lib/php5/20090626+lfs/pdo.so
    /usr/lib/php5/20090626+lfs/pdo_mysql.so
    

    I was a little worried that these look they might be old versions, but I used their paths anyway. Stefgosselin identified the location of the ini files, /etc/php5/conf.d/. I modified them all. The command below will modify all of the *.ini files there, so make sure all of yours really need modifying. Obviously you need to use the target path you discovered with the locate command in place of mine, /usr/lib/php5/20090626+lfs/:

     sudo sed -ri -e "s|^(extension=)(\w{2,10}[.]so)$|\1/usr/lib/php5/20090626+lfs/\2|g" /etc/php5/conf.d/*.ini
    

    Before finding this solution I tried several apt-get purge and apt-get reinstall commands without luck. I'm not sure, but my problem may have originated with installation of zend from source or phpmyadmin with aptitude. It never caused any php errors, just the annoying warning you mentioned. Finally php5 can launch without errors:

    php5 --version

    gives ...

    PHP 5.3.5-1ubuntu7.2 with Suhosin-Patch (cli) (built: May  2 2011 23:18:30)  Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
        with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
    

提交回复
热议问题