簡體   English   中英

PHP 模塊顯示在 php cli 中,而不顯示在 Apache(XAMPP、Mac OS Mojave)中

[英]PHP module shows in php cli, not in Apache (XAMPP, Mac OS Mojave)

我設法在我的機器上啟用了 intl 模塊(這很棘手),當我執行php -m | grep intl php -m | grep intl我看到列出的模塊。 我的問題是該模塊似乎已啟用,但 XAMPP 可能仍在加載一些其他版本的 PHP,但它不是。

which php的輸出是:

/usr/local/opt/php@7.1/bin/php

php -v的輸出是:

PHP 7.1.26 (cli) (built: Feb 26 2019 10:26:24) ( NTS ) 版權所有 (c) 1997-2018 The PHP Group Zend Engine v3.1.0, 版權所有 (c) 1998-2018 Zend Technologies with Zend OPcache v7.1.26,版權所有 (c) 1999-2018,由 Zend Technologies

php -i | grep intl輸出php -i | grep intl php -i | grep intl是:

配置命令 => './configure' '--prefix=/usr/local/Cellar/php@7.1/7.1.26' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local /etc/php/7.1' '--with-config-file-path=/usr/local/etc/php/7.1' '--with-config-file-scan-dir=/usr/local/etc/php /7.1/conf.d'--with-pear=/usr/local/Cellar/php@7.1/7.1.26/share/php@7.1/pear''--enable-bcmath''--啟用日歷''--enable-dba' '--enable-dtrace' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-opcache-file' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-webhelper' '--啟用-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--啟用- zip''--with-apxs2=/usr/local/opt/httpd/bin/apxs''--with-bz2=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ MacOSX10.14.sdk/usr''--with-curl=/usr/local/opt/curl-openssl''--with-fpm-user=_www''--with-fpm-group=_www''- -機智 h-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-gmp=/usr/local/ opt/gmp''--with-iconv=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr''--with-icu-dir=/ usr/local/opt/icu4c''--with-jpeg-dir=/usr/local/opt/jpeg''--with-kerberos=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/開發人員/SDKs/MacOSX10.14.sdk/usr''--with-layout=GNU''--with-ldap=/usr/local/opt/openldap''--with-ldap-sasl=/Applications/Xcode .app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr''--with-libedit=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /SDKs/MacOSX10.14.sdk/usr''--with-libxml-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr'' --with-libzip' '--with-mcrypt=/usr/local/opt/mcrypt' '--with-mhash=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf orm/Developer/SDKs/MacOSX10.14.sdk/usr''--with-mysql-sock=/tmp/mysql.sock''--with-mysqli=mysqlnd''--with-ndbm=/Applications/Xcode .app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr''--with-openssl=/usr/local/opt/openssl''--with-pdo-dblib= /usr/local/opt/freetds''--with-pdo-mysql=mysqlnd''--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc''--with-pdo-pgsql=/ usr/local/opt/libpq' '--with-pdo-sqlite=/usr/local/opt/sqlite' '--with-pgsql=/usr/local/opt/libpq' '--with-pic' ' --with-png-dir=/usr/local/opt/libpng' '--with-pspell=/usr/local/opt/aspell' '--with-sqlite3=/usr/local/opt/sqlite' ' --with-tidy=/usr/local/opt/tidy-html5' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-webp-dir=/usr/local/opt/webp ' '--with-xmlrpc' '--with-xsl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr' '--with-zlib =/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr' intl intl.default_locale => 無值 => 無值 intl.error_level => 0 => 0 intl.use_exceptions => 0 => 0

這些是我的 bash 配置文件中的路徑:

導出路徑="/usr/local/opt/php@7.1/bin:$PATH" 導出路徑="/usr/local/opt/php@7.1/sbin:$PATH"

然后,在php.ini我取消注釋這一行:

擴展名=intl.so

xdebug也已啟用:

; 啟用 xdebug zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" xdebug.remote_enable=on xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=90.0 max_nesting_level=500

httpd.conf ,我像這樣加載 PHP 模塊:

LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

我已經檢查過 httpd.conf 沒有包含在附加文件中(正如這個答案所建議的那樣)。 我懂了:

包括“/Applications/XAMPP/xamppfiles/apache2/conf/httpd.conf”

但是那個額外的配置文件只包含虛擬目錄。

我的 phpinfo 吐出這個 PHP 版本:

PHP 版本 7.1.13

我讀過 Apache2 的 PHP cli 和 PHP 模塊不一定具有相同的版本,但這是我的問題:

為什么 intl 模塊在 PHP cli 中正確加載而不是在 Apache2 PHP 模塊中?

PS:有大約裝載了不正確的模塊日志中沒有錯誤,在我重新命名它有php_intl.dllintl.so ,但現在不是了。

XAMPP 有自己捆綁的 Apache+PHP。 它運行 php 作為 apache 模塊。

要將 php 作為 apache 模塊運行,您應該使用參數 --with-apxs 從源代碼重新編譯 mod php。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM