在 Mac OSX 10.5 上编译 PHP-GD

发布于 2024-07-14 03:43:58 字数 581 浏览 3 评论 0原文

我已按照此处的有用说明进行操作: 安装Mac OS X 10.5 Leopard 上的 GD for PHP

我的扩展目录位于 php.ini 文件中,如下所示:

extension_dir =“/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/”

但是当我尝试加载 GD 时,出现错误:

PHP 启动:无法加载动态库 '/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) 位于第 0 行未知 GDB - GNU 调试器协议 => $修订版:1.88 $

这是一个常见错误。 有人能指出我正确的方向吗?

I've followed the helpful instructions here:
Install GD for PHP on Mac OS X 10.5 Leopard

And I have my extension directory in php.ini file like this:

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"

But when I try and load GD, I get an error:

PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) in Unknown on line 0
GDB - GNU Debugger protocol => $Revision: 1.88 $

This is a common error. Can someone point me in the right direction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

对风讲故事 2024-07-21 03:43:59

重新安装 PHP 后(例如,编译 PHP在 Mac OS X 上使用 GD2),这修复了与 PHP 扩展未加载(因此不允许 PEAR 和其他扩展启动)相关的最常见错误。

输入 Terminal.app:
sudo mv /usr/bin/php /usr/bin/php_back
sudo ln -s /usr/local/php5/bin/php /usr/bin/php

这会备份与 OSX 捆绑在一起的 PHP CLI,然后符号链接到新的正确位置(请小心,因为此位置可能会因每个 PHP 的安装而异,在这种情况下,您应该替换 /usr/ local/php5/bin/php 以及新安装文件的正确路径)。

After you do a new install of PHP (for example, to have PHP compiled with GD2 on Mac OS X) this fixes the most common errors related to PHP extensions not loading (and therefore not allowing PEAR and others to start).

Type in Terminal.app:
sudo mv /usr/bin/php /usr/bin/php_back
sudo ln -s /usr/local/php5/bin/php /usr/bin/php

This makes a backup of PHP's CLI that comes bundled with OSX, and then symlinks to the new correct location (be careful, since this location may vary with each PHP's installation, in this case you should replace /usr/local/php5/bin/php with the correct route to the newly installed file).

睡美人的小仙女 2024-07-21 03:43:58

我遇到了完全相同的错误,我花了几个小时才找到。 答案是您需要确保为您的处理器编译正确的版本。 就我而言,我不记得 PPC G5 是 64 位处理器,并且失败是因为我使用的是 32 位版本。

我还发现更改两条配置行以更具体地设置 PPC64 架构很有帮助,如下所示

对于 jpeg-6b:

以下行无法正常工作:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-shared

但是这一行可以(至少在 G5 上):

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64 -g -Os -pipe" LDFLAGS="-arch ppc64 -bind_at_load" ./configure --enable-shared

对于 GD:

下面一行不能正常工作:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6

但是这一行可以(至少在 G5 上):

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64  -g -Os -pipe" LDFLAGS=" -arch ppc64  -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6

I had exactly the same error, and it took me several hours to track down. The answer is that you need to make sure you're compiling the right version for your processor. In my case, I was not remembering that the PPC G5 is a 64-bit processor, and this was failing because I was using the 32-bit versions.

I also found it was helpful to change the two config lines to be more specific about setting things up for the PPC64 architecture, as follows

For jpeg-6b:

THE FOLLOWING LINE DOES NOT WORK PROPERLY:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --enable-shared

BUT THIS ONE DOES (ON THE G5 AT LEAST):

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64 -g -Os -pipe" LDFLAGS="-arch ppc64 -bind_at_load" ./configure --enable-shared

For GD:

THE FOLLOWING LINE DOES NOT WORK PROPERLY:

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6

BUT THIS ONE DOES (ON THE G5 AT LEAST):

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=" -arch ppc64 -g -Os -pipe -no-cpp-precomp" CCFLAGS=" -arch ppc64 -g -Os -pipe" CXXFLAGS="-arch ppc64  -g -Os -pipe" LDFLAGS=" -arch ppc64  -bind_at_load" ./configure --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6
小糖芽 2024-07-21 03:43:58

Extension_dir 的路径错误。

The path to extension_dir was wrong.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文