在 PHP 中启用 GD 支持
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4646456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Enable GD support in PHP
提问by Dónal
I'm trying to install pixelpost on an Apache server on windows. The installer is failing because:
我正在尝试在 Windows 上的 Apache 服务器上安装 pixelpost。安装程序失败,因为:
Pixelpost will not run if your PHP installation is not compiled with the GD graphics library.
如果您的 PHP 安装未使用 GD 图形库编译,则 Pixelpost 将不会运行。
I've added the following line to php.ini
我已将以下行添加到 php.ini
extension=php_gd2.dll
But I still get the same error message. When I run phpinfo()
I don't see any reference to GD, so I guess it really isn't installed. I searched for php_gd2.dll
and it's in the ext
subfolder of my PHP root dir.
但我仍然收到相同的错误消息。当我运行时,phpinfo()
我没有看到任何对 GD 的引用,所以我想它确实没有安装。我搜索了php_gd2.dll
它,它在ext
我的 PHP 根目录的子文件夹中。
I know nothing about PHP, so be gentle with me.
我对 PHP 一无所知,所以对我温柔一点。
Update
更新
To answer the questions raised in the comments:
回答评论中提出的问题:
- I restarted Apache after modifying
php.ini
php.ini
is in the root dir of my PHP installationC:\php\php.ini
- 修改后我重启了Apache
php.ini
php.ini
位于我的 PHP 安装的根目录中C:\php\php.ini
回答by Amil Waduwawara
Following are the steps for any php
extension (on MS-Windows
):
以下是任何php
扩展的步骤(在MS-Windows
):
- Give absolute path (not relative) to extensions directory [use forward slashes (
/
) instead of backslashes (\
); I'm not too sure whether it's required to end the path with trailing slash.- e.g.:
extension_dir = c:/php5/ext
- e.g.:
- Make sure
php
is referring yourphp.ini
, nowphp.ini
can be inside yourphp
installation root dir.- If your changes to
php.ini
are reflected onphpinfo()
, it's OK. If not, please refer toINSTALL
file inphp
root dir.
- If your changes to
- Restart
apache
if you're bindingphp
as a module toapache
- 提供扩展目录的绝对路径(不是相对路径)[使用正斜杠 (
/
) 而不是反斜杠 (\
); 我不太确定是否需要用斜杠结束路径。- 例如:
extension_dir = c:/php5/ext
- 例如:
- 确保
php
是指您的php.ini
, 现在php.ini
可以在您的php
安装根目录中。- 如果您对 的更改
php.ini
反映在 上phpinfo()
,则没关系。如果没有,请参考根目录中的INSTALL
文件php
。
- 如果您对 的更改
- 重新启动
apache
,如果你要绑定php
的模块apache