php gd lib 已安装但无法运行
在本地主机上,库工作正常,当在生产环境中调用该函数时,php 会抛出致命错误。
我检查了 phpinfo() 那里并且它已启用。
我很想看看是否可以在 php.ini 上添加任何内容,但我找不到任何内容。 抛出错误
gd_info();
当我调用Is there everything that I can add on php.ini file 可以解决这个问题时
,或者是否有另一个 gd 库?我得到的错误如下
Fatal error: Call to undefined function gd_info(
On the localhost the library is working fine, when the function is called on production,php throws a fatal errer.
i checked the phpinfo() its there and it is enabled.
I tired to see if there is anything that i can add on the php.ini but i couldn't find any.
The error is thrown when i call
gd_info();
Is there anything that i can add on the php.ini file that can solve this problem, or is there another library for gd?
The error am getting is the following
Fatal error: Call to undefined function gd_info(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能有点晚了,但我希望它对任何人都有帮助。
当我尝试通过 apache 运行 GD 时,我遇到了同样的问题。
问题出在 apache 的
php.ini
路径中。默认情况下,它不使用 php 目录中的php.ini
。您需要在
httpd
文件中定义PHPIniDir
或将php.ini
的副本放置到 apache 文件夹中。要检查是否属于您的情况,您可以比较 php 文件夹中的
php --ini
输出和 apache 上的phpinfo()
输出。如果它显示不同的php.ini
目的地,您需要修复它。It may be a little bit late, but I hope it helps anyone.
I had the same problem when I tried to run GD over apache.
The problem was in
php.ini
path for apache. By default it is not usingphp.ini
from php directory.You need to define
PHPIniDir
inhttpd
file or place copy ofphp.ini
to apache folder.To check if it is your case you can compare output of
php --ini
from php folder and output ofphpinfo()
over apache. If it is showing differentphp.ini
destinations you need to fix it.我遇到了完全相同的问题,
尽管我使用 apt-get install php7.0-gd 安装了它,但该函数未定义,所以我检查了 中的 php.ini 文件>/etc/php/7.0/apache2/php.ini
原来 gd 扩展行被注释了!
所以我删除了行前的分号并且它起作用了!
太疯狂了,浪费了我的半个小时:D
I had exactly the same problem
although I had installed it using
apt-get install php7.0-gd
that function was undefined, so I inspectedphp.ini
file in/etc/php/7.0/apache2/php.ini
turned out that the line for gd extension was commented!
so I removed semicolon before the line and it was working!
so crazy wasted an half an hour of mine :D