配置已安装的 PHP 以使用已安装的 ncurses (MAMP)

发布于 2024-07-30 11:37:14 字数 235 浏览 4 评论 0原文

我已经安装了 MAMP,但它附带的 PHP 不是用 ncurses 编译的。 我尝试使用端口来安装ncurses,它似乎已经存在于我的系统上,所以现在我想知道是否有办法让PHP使用它无需重新编译 PHP --with-ncurses 。

换句话说:PHP 可以配置为使用 ncurses 而无需重新编译吗?

I have installed MAMP and the PHP it came with wasn't compiled with ncurses. I've tried to use port to install ncurses and it seems that it already exists on my system so now I was wondering if there was a way to get PHP to use it without having to recompile PHP --with-ncurses.

In other words: Can PHP be configured to use ncurses without the recompilation?

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

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

发布评论

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

评论(2

演多会厌 2024-08-06 11:37:16

根据手册,必须编译ncurses。一些扩展可以可以编译为共享库(dll/so)并动态加载,但有些不能。 看来 ncurses 不能。

我不太了解 mac 软件包的结构,但这不是 bsd/ports 风格的安装吗? 在这种情况下,只需找到该包并配置+重新编译它即可。

编辑:我看到 mamp 是一个二进制发行版。 那你就不走运了。 我建议你至少从源安装 php。 能够安装新的扩展等非常有用。编译 php 相当简单,所以即使您对编译东西不完全有信心,您也应该能够通过它。

According to the manual, ncurses must be compiled in. Some extensions can be compiled as shared libraries (dll/so) and loaded dynamically, but some can't. Seems that ncurses can't.

I don't know a lot about how mac packages are structured, but isn't it a bsd/ports style installation? In that case, just find the package and configure + recompile it.

Edit: I see that mamp is a binary distribution. You're out of luck then. I would suggest that you install at least php from sources. It's very useful to be able to install new extensions etc. It's fairly straight forward to compile php, so even if you aren't completely confident with compiling stuff, you should be able to huddle through it.

樱娆 2024-08-06 11:37:15

我很抱歉这么晚才回答,但这实际上可以使用 MAMP 轻松完成。

我在运行 OS X Snow Leopard 的 MacBook 上完成了此操作。

您的 MAMP 目录包含 php 源代码的 tar 文件。 MAMP 版本 1.8.4 附带 php-5.2.11.tar,位于以下位置:/Applications/MAMP/bin/php5/

  1. cd /Applications/MAMP/bin/php5/
  2. tar -xvf php-5.2。 11.tar
  3. cd php-5.2.11/ext/ncurses
  4. /Applications/MAMP/bin/php5/bin/phpize
  5. ./configure --with-php-config=/Applications/MAMP/bin/php5/bin/php-config
  6. make
  7. make install

之后你只需要将 ncurses.so 扩展添加到 MAMP php.ini

  1. echo "extension=ncurses.so" >>> /Applications/MAMP/conf/php5/php.ini
  2. php -i | grep ncurses

这给了我:

ncurses

ncurses 支持 => 已启用

ncurses 库版本 => 5.7

您也可以使用 PCNTL 扩展来完成此操作 ;) ;)

干杯!

I'm sorry for the late answer but this can actually be done quite easily with MAMP.

I have done this on my MacBook running OS X Snow Leopard.

Your MAMP directory contains the tar file of the php source code. MAMP version 1.8.4 ships with php-5.2.11.tar located here: /Applications/MAMP/bin/php5/

  1. cd /Applications/MAMP/bin/php5/
  2. tar -xvf php-5.2.11.tar
  3. cd php-5.2.11/ext/ncurses
  4. /Applications/MAMP/bin/php5/bin/phpize
  5. ./configure --with-php-config=/Applications/MAMP/bin/php5/bin/php-config
  6. make
  7. make install

Afterwards you just need to add the ncurses.so extension to the MAMP php.ini

  1. echo "extension=ncurses.so" >> /Applications/MAMP/conf/php5/php.ini
  2. php -i | grep ncurses

This gives me:

ncurses

ncurses support => enabled

ncurses library version => 5.7

You can also do this with the PCNTL extension ;) ;)

Cheers!

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