之前把homestead中的nginx替换为openresty后就发现php控制台运行时会报一个错:
undefined symbol: gdImageCreateFromJpeg in Unknown on line 0
查了百度,有一个英文帖子提供了解决方案
原贴如下
Problem:
Executing `php` prints the folowing error:|
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20060613+lfs/gd.so' - /usr/lib/php5/20060613+lfs/gd.so:
undefined symbol: gdImageCreateFromJpeg in Unknown on line 0
more specifically when processing a php page it displays the folowing:
|*Fatal error*: Call to undefined function imageCreate()
in */home/irc/website/makeworldmap.php* on line *13*
|
Answer:
There's something wrong with gd itself,|
|/usr/lib/php5/20060613+lfs/gd.so is different from one of a clean install
It actually loads the wrong libgd, which can be found by typing `locate libgd`
We find other versions of libgd in /usr/local/lib/:
libgd.so, libgd.so.2, libgd.so.2.0.0
do the folowing things:
sudo mkdir libgd.backup
sudo mv libgd.so* libgd.backup
restart apache: sudo /etc/init.d/apache2 restart|
大致说的是这个是gd库自己的问题
因为gd.so安装的有问题,先运行
locate libgd
发现homestead中有好多libgd的相关文件但我们要找的是libgd.so开头的
所以运行
locate libgd.so
查到在/usr/local/lib目录下有几个libgd.so开关的文件,在/usr/local/lib目录下面建一个gd_backup目录
然后把这些文件剪切到gd_backup目录重启nginx
mkdir gd_backup
mv libgd.* gd_backup
重新运行php没有问题了
个人认为这个问题是gd.so多次安装且安装的版本不一样,导致php加载