Home  >  Article  >  Backend Development  >  How to install and configure php imap

How to install and configure php imap

藏色散人
藏色散人Original
2021-07-02 10:13:153024browse

How to install and configure php imap: 1. Install the required dependencies; 2. Download the php7.4 source code package; 3. Compile the extension module; 4. Modify php.ini to add the imap extension.

How to install and configure php imap

The operating environment of this article: Centos7 system, PHP7.4 version, DELL G3 computer

How to install and configure php imap?

php7 install imap extension

Currently using Centos7.x system, php uses version 7.4, wlnmp one-click package already supports this extension

imap extension is included in php In the source code package

1. Install the required dependencies. If you are prompted that other dependencies are missing during compilation, please install them yourself

yum install autoconf gcc gcc-c++ libc-client-devel krb5-devel openssl-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
yum install autoconf gcc gcc-c++ libc-client-devel krb5-devel openssl-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so

2. Download the php7.4 source code package

wget https://www.php.net/distributions/php-7.4.5.tar.gz
tar xf php-7.4.5.tar.gz
cd php-7.4.5/ext/imap
/usr/local/php/bin/phpize
wget https://www.php.net/distributions/php-7.4.5.tar.gz
tar xf php-7.4.5.tar.gz
cd php-7.4.5/ext/imap
/usr/local/php/bin/phpize

Just run it according to the location of your own phpize (if you don’t know where phpize is, just find / -name phpize to search). After running, the following information will be prompted, and then compile

Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902

3. Compile the extension module

./configure --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap-ssl
make
make install
./configure --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap-ssl
make
make install

After the execution is completed, the directory where the extension module is compiled will be displayed /usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/

4. Modify php.ini and add Extension

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/"
extension=imap.so
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/"
extension=imap.so

Note: If the extension_dir path has been configured before, you only need to configure extension=imap.so

Save and exit, restart php

Pass php -m | grep imap command can see that the extension has taken effect

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install and configure php imap. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn