【问题标题】:How can I Enable Webp support in php GD library in MAC如何在 MAC 的 php GD 库中启用 Webp 支持
【发布时间】:2017-11-24 05:48:15
【问题描述】:

我已经使用自制软件安装了 PHP PHP 7.2.0beta3。 phpinfo 表示启用了 webmp 支持,

但是当我尝试使用wrapper class 转换图像时,它会显示此错误:

未捕获的错误:调用 /Users/rakibtg/Projects/PHP-ImageToWebp/ImageToWebp.php:37 堆栈跟踪中的未定义函数 imagewebp() ...

如何在 macOS 中使用 homebrew php 安装环境启用 webp 支持?

【问题讨论】:

  • 您在该列表中的哪个位置看到了 WebP? WBMP ≠ WebP。
  • 是的,这就是我的要求

标签: php macos homebrew


【解决方案1】:

尝试以下方法:

brew reinstall php72 --with-webp

或者,如果失败,请尝试:

brew rm php72
brew install webp
brew install php72 --with-webp

通常,您可以通过以下方式找到任何给定软件包的可用选项:

brew options <PACKAGENAME>

例如:

brew options homebrew/php/php72

样本输出

--with-argon2
    Include libargon2 password hashing support
--with-cgi
    Enable building of the CGI executable (implies --without-fpm)
--with-debug
    Compile with debugging symbols
--with-enchant
    Build with enchant support
--with-gmp
    Build with gmp support
--with-homebrew-curl
    Include Curl support via Homebrew
--with-homebrew-libressl
    Include LibreSSL instead of OpenSSL via Homebrew
--with-homebrew-libxml2
    Include Libxml2 support via Homebrew
--with-homebrew-libxslt
    Include LibXSLT support via Homebrew
--with-httpd
    Enable building of shared Apache Handler module
--with-imap
    Include IMAP extension
--with-libmysql
    Include (old-style) libmysql support instead of mysqlnd
--with-mssql
    Include MSSQL-DB support
--with-pdo-oci
    Include Oracle databases (requries ORACLE_HOME be set)
--with-pear
    Build with PEAR
--with-phpdbg
    Enable building of the phpdbg SAPI executable
--with-postgresql
    Build with postgresql support
--with-thread-safety
    Build with thread safety
--with-webp
    Build with webp support
--without-bz2
    Build without bz2 support
--without-fpm
    Disable building of the fpm SAPI executable
--without-ldap
    Build without LDAP support
--without-legacy-mysql
    Do not include the deprecated mysql_ functions
--without-libsodium
    Build without libsodium support
--without-mysql
    Remove MySQL/MariaDB support
--without-pcntl
    Build without Process Control support
--without-unixodbc
    Build without unixODBC support
--HEAD
    Install HEAD version

【讨论】:

  • 它不再工作了,无法在 php 7.1.31 上使用 webp,我不知道如何启用它
  • @AmauryLeproux 看看这里...stackoverflow.com/a/50529784/2836621
  • 嗯,我无法 rm 我的版本,也无法在没有 sudo 的情况下使用 PECL,甚至尝试使用 sudo 都失败了。并且 WEBP 仍然不被称为函数:/
猜你喜欢
  • 2016-11-15
  • 2011-06-06
  • 1970-01-01
  • 1970-01-01
  • 2014-05-12
  • 2012-02-19
  • 2018-08-26
  • 1970-01-01
  • 2021-01-01
相关资源
最近更新 更多