lae*_*aef 8 php macos homebrew php-imap
我在OS X El Capitan上使用PHP 7.2,使用Homebrew(当然)安装.现在我想使用PHP的IMAP扩展中的一些IMAP函数,但无论我搜索什么,我都找不到在OSX上添加扩展的方法.
我尝试过的一些事情......当然,我尝试过最常用的方法:
$ brew reinstall php --with-imap
Run Code Online (Sandbox Code Playgroud)
然而,这失败了,回归:
Warning: php: this formula has no --with-imap option so it will be ignored!
Run Code Online (Sandbox Code Playgroud)
我在传递中提到的另一种方法也失败了:
$ brew install php72-imap
Error: No available formula with the name "php72-imap"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Run Code Online (Sandbox Code Playgroud)
我不确定要用这个方向.我确信有一种简单的,可能记录在案的方式,但我还没有找到它.也许我只是在错误的地方寻找并使用错误的搜索条件......
小智 14
过期后kabel/php-ext/php@7.2-imap,我使用了另一个水龙头:
brew tap shivammathur/php
brew tap shivammathur/extensions
brew install imap@7.2
Run Code Online (Sandbox Code Playgroud)
Ort*_*kni 12
Kevin Abel提供了一些从Homebrew/core中删除的PHP扩展.您可以使用以下命令安装IMAP扩展:
brew tap kabel/php-ext
brew install php-imap
Run Code Online (Sandbox Code Playgroud)
wto*_*rsi 10
对于那些喜欢imap使用本机命令安装ext 而不添加其他点击或其他内容的人来说,这是一个答案。
简而言之,我们需要从源代码编译扩展。好的,这是过程。
$ # Download sources from php.net of already installed php version.
$ cd ~/Downloads
$ wget https://www.php.net/distributions/php-7.3.5.tar.gz
$ gunzip php-7.3.5.tar.gz
$ tar xvf php-7.3.5.tar
$ # Go to ext dir
$ cd php-7.3.5/ext/imap
$ # prepare extension using phpize command, you should
$ # ensure that you use phpize of proper version from
$ # already installed php version as checking the API version for example
$ phpize
$ # prepare dependencies
$ # install openssl and imap
$ brew install openssl
$ brew install imap-uw
$ # after all installation check the installed paths of the exts
$ ./configure --with-kerberos --with-imap-ssl=/usr/local/Cellar/openssl/1.0.2r/ --with-imap=/usr/local/Cellar/imap-uw/2007f/
$ make
$ # get extension dir
$ php -i | grep extension_dir
extension_dir => /usr/local/lib/php/pecl/20180731 => /usr/local/lib/php/pecl/20180731
$ cp modules/imap.so /usr/local/lib/php/pecl/20180731/
$ # add extension to your php.ini
# [imap]
# extension="imap.so"
Run Code Online (Sandbox Code Playgroud)
就是这样。祝你好运!
这是我在Mojave下解决此问题的方法:
首先,我为PHP 7.2安装了IMAP模块
brew install kabel/php-ext/php@7.2-imap
Run Code Online (Sandbox Code Playgroud)
其次,我将imap.so从安装的文件夹复制到php.ini使用的'extension_dir'
sudo cp /usr/local/lib/php/20170718/imap.so to /usr/local/lib/php/pecl/20170718
Run Code Online (Sandbox Code Playgroud)
小智 6
有一种更好的方法可以直接使用 Homebrew 重新编译带有 IMAP 扩展名的 php。
运行brew edit php@7.4
在depends_on部分的末尾添加depends_on "imap-uw"
检查depends_on部分中的openssl版本
在 --with 部分的末尾添加--with-imap=#{Formula["imap-uw"].opt_prefix}
在--with-imap 之后添加--with-imap-ssl=#{Formula["openssl@1.1"].opt_prefix}。检查它是否与depends_on 部分中的版本相同
运行brew restart --build-from-source php@7.4
php.ini 中的 php_imap.so 扩展不需要启用,因为它已经编译成 PHP 了。你可以检查 phpinfo();
如果功能中的公式更新,只需再次编辑公式并使用 --build-from-source 重新安装。
| 归档时间: |
|
| 查看次数: |
7477 次 |
| 最近记录: |