OS X上的GD2和PHP [英] GD2 and PHP on OS X

查看:99
本文介绍了OS X上的GD2和PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于此主题的链接很多,但是都有不同的方法.我全新安装了os x 10.5.6.我正在使用操作系统随附的PHP版本.

There are tons of links on this topic - but all have a different approach. I have a clean install of os x 10.5.6. I'm using the version of PHP that came with the OS.

我已经使用FINK安装了GD,它已经安装了相关的软件包. 我的问题是,现在如何在PHP中获得GD支持?

I have installed GD using FINK, it has installed associated packages. My question is, how do I now get GD support in PHP?

(不建议使用macports或marc liyanage建议,因为这涉及撤消我已经完成的其他安装的pear,mysql和php)

推荐答案

正如Nerdling指出的那样,PHP必须在启用GD扩展的情况下进行编译,因此没有 clean 将GD2添加到版本中的方法Mac OS X附带的PHP版本.

As Nerdling points out, PHP must be compiled with the GD extension enabled, therefore there's no clean way of adding GD2 to the version of PHP that ships with Mac OS X.

该解决方案对我有效(Mac OS X 10.5.2,应与任何10.5兼容),但是您必须重新安装PHP.但是,这不会撤消您对PEAR和MySQL的其他安装,您只需sudo多一行.

This solution worked for me (Mac OS X 10.5.2, should work with any 10.5), but you'll have to make a new PHP installation. However, this will not undo your other installs of PEAR and MySQL, you'll just have to sudo one extra line.

开始之前,如果已经启用了内置PHP,则必须在(/etc/apache2/)httpd中重新注释PHP行(LoadModule php5_module libexec/apache2/libphp5.so). conf.现在,执行以下步骤:

Before we start, if you've already enabled the built in PHP, you'll have to re-comment the PHP line (LoadModule php5_module libexec/apache2/libphp5.so) in (/etc/apache2/)httpd.conf. And now, the steps:

  1. 在Terminal.app中,键入sudo ln -s /etc/apache2 /etc/httpd
    这样可以建立一个符号链接,以便熵的程序包可以正确安装和运行.

  2. 下载熵的 PHP 5.2.4适用Apache 2 软件包并安装.

  3. 再次在终端中,键入:

    sudo cp /usr/sbin/httpd /usr/sbin/httpd-fat
    sudo lipo /usr/sbin/httpd -thin i386 -output /usr/sbin/httpd

    这会将Apache 2降级到32位,因此可以与熵的PHP包一起很好地发挥作用.

    sudo ln -s /usr/local/php5 /usr/local/apache2
    sudo ln -s /usr/lib/libexpat.dylib /usr/local/apache2/lib/libexpat.0.dylib

    这可以修复文件放错的地方.

    sudo mv /usr/bin/php /usr/bin/php_back
    sudo ln -s /usr/local/php5/bin/php /usr/bin/php

    这可以修复PEAR/PHP扩展的可能错误.

  4. 重新启动Apache(可以通过键入sudo apachectl restart完成).

  5. Upvote;)

  6. 完成.

  1. In Terminal.app, type sudo ln -s /etc/apache2 /etc/httpd
    This makes a symlink so entropy's package can install and function correctly.

  2. Download entropy's PHP 5.2.4 for Apache 2 package and install it.

  3. Again in Terminal, type:

    sudo cp /usr/sbin/httpd /usr/sbin/httpd-fat
    sudo lipo /usr/sbin/httpd -thin i386 -output /usr/sbin/httpd

    This downgrades Apache 2 to 32 bits so it can play nice with entropy's PHP package.

    sudo ln -s /usr/local/php5 /usr/local/apache2
    sudo ln -s /usr/lib/libexpat.dylib /usr/local/apache2/lib/libexpat.0.dylib

    This fixes a misplaced file.

    sudo mv /usr/bin/php /usr/bin/php_back
    sudo ln -s /usr/local/php5/bin/php /usr/bin/php

    This fixes possible errors with PEAR/PHP extensions.

  4. Restart Apache (can be done typing sudo apachectl restart).

  5. Upvote ;)

  6. Done.

一些参考资料: http://www.entropy.ch /phpbb2/viewtopic.php?t=3074

这篇关于OS X上的GD2和PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆