简体   繁体   English

PHP如何启用扩展

[英]php how to enable an extension

i already have xampp installed. 我已经安装了xampp。 the version of xampp is: xampp的版本是:

XAMPP 5.6.12-0 XAMPP 5.6.12-0

I am working on: 我正在努力:

OS X El Capitan, Version 10.11.1 OS X El Capitan,版本10.11.1

I have php.ini in this path: 我在这条路径中有php.ini

/Applications/XAMPP/xamppfiles/etc/php.ini /Applications/XAMPP/xamppfiles/etc/php.ini

inside it, there is line: 里面有一行:

extension=php_imap.dll

However, that IMAP extension is not loaded, I knew that because I run this command on the terminal: 但是,该IMAP扩展未加载,我知道是因为我在终端上运行了以下命令:

php -r "print_r(get_loaded_extensions());"

and this is the result I get: 这是我得到的结果:

Array
(
    [0] => Core
    [1] => date
    [2] => ereg
    [3] => libxml
    [4] => openssl
    [5] => pcre
    [6] => sqlite3
    [7] => zlib
    [8] => bcmath
    [9] => bz2
    [10] => calendar
    [11] => ctype
    [12] => curl
    [13] => dba
    [14] => dom
    [15] => hash
    [16] => fileinfo
    [17] => filter
    [18] => ftp
    [19] => gd
    [20] => SPL
    [21] => iconv
    [22] => json
    [23] => ldap
    [24] => mbstring
    [25] => session
    [26] => standard
    [27] => mysqlnd
    [28] => mysqli
    [29] => PDO
    [30] => pdo_mysql
    [31] => pdo_sqlite
    [32] => Phar
    [33] => posix
    [34] => readline
    [35] => Reflection
    [36] => mysql
    [37] => shmop
    [38] => SimpleXML
    [39] => snmp
    [40] => soap
    [41] => sockets
    [42] => exif
    [43] => sysvmsg
    [44] => sysvsem
    [45] => sysvshm
    [46] => tidy
    [47] => tokenizer
    [48] => wddx
    [49] => xml
    [50] => xmlreader
    [51] => xmlrpc
    [52] => xmlwriter
    [53] => xsl
    [54] => zip
)

my question 我的问题

How to install/enable the IMAP extension 如何安装/启用IMAP扩展

I searched online, and I found this question , they said to add the extension=php_imap.dll to my php.ini . 我在网上搜索,发现了这个问题 ,他们说要将extension=php_imap.dll添加到我的php.ini However, it is already there. 但是,它已经在那里。

I continue searching, and I found this question , they said to do apt-get install php5-imap . 我继续搜索,发现了这个问题 ,他们说要做apt-get install php5-imap However, I got the following error on the terminal 但是,我在终端上遇到以下错误

apt-get: command not found

Do you know how can I enable/install the IMAP extension? 您知道如何启用/安装IMAP扩展程序吗?

Thanks 谢谢

When using OSX uncommenting a .dll extension seems rather odd. 使用OSX时,取消注释.dll扩展名似乎很奇怪。 Look for this line: extension=imap.so and uncomment, if commented. 查找以下行:extension = imap.so,如果有注释,则取消注释。 Afterwards restart your apache . 然后重新启动您的Apache Then you can check by putting a test.php file with the following content to your localhost: 然后,您可以通过将具有以下内容的test.php文件放入本地主机来进行检查:

<?php
echo phpinfo();

If you do so and open the site, search the site for imap. 如果这样做并打开该站点,请在该站点中搜索imap。 It should have something like imap as a headline with 它的标题应该像imap这样
IMAP c-Client Version 2XXX

If you find that entry, the extension should have loaded. 如果找到该条目,则扩展程序应该已经加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM