Home >Backend Development >PHP Tutorial >OS X EI Capitan installation mcrypt, capitanmcrypt_PHP tutorial
After the mac operating system was upgraded to 10.11.2 (OS Neither could be successfully installed; I was troubled for a long time. When installing after compilation, it always prompts
<span class="line">1</span> |
<span class="line">[cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@17000#: Operation not permitted]</span> |
Finally found the problem
When you enter the /usr/lib/php/extensions/ directory, you will find that the directory cannot be operated at all (manual copying and moving), and you do not have permission to use root in the terminal; but is it impossible? I am already a root user, why is it not allowed? It turns out that OSX 10.11 El Capitan has added a new security mechanism called System Integrity Protection (SIP), so for the directory
Only for system use, other users or programs cannot use it directly, and our /usr/lib/php/extensions/ happens to be within the protected scope
So the solution is to disable the SIP protection mechanism. The steps are:
After disabling SIP, you can install it smoothly. Of course, you can re-enable SIP after installation. The method is the same as above, but the command is csrutil enable
<span class="line">1</span> |
<span class="line">cd ~ ; mkdir mcrypt ; cd mcrypt</span> |
Download
libmcrypt2.5.8 and the php version of your system to the mcrypt directory
Unzip
<span class="line">1</span> |
<span class="line">tar -zxvf libmcrypt-2.5.8.tar.gz tar -zxvf php-5.5.27.tar.gz rm *.gz</span> |
Install libmcrypt
<span class="line">1</span> |
<span class="line">cd libmcrypt-2.5.8 ./configure make sudo make install</span> |
Install autoconf
<span class="line">1</span> |
<span class="line">cd ~/mcrypt curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz tar xvfz autoconf-latest.tar.gz cd autoconf-2.69/ ./configure make sudo make install</span> |
Compile mcrypt php extension
<span class="line">1</span> |
<span class="line">cd ../php-5.5.27/ext/mcrypt/ /usr/bin/phpize</span> |
The above will output:
<span class="line">1</span> |
<span class="line">Configuring for: PHP Api Version: 20121113 Zend Module Api No: 20121212 Zend Extension Api No: 220121212</span> |
Then compile:
<span class="line">1</span> |
<span class="line">./configure make sudo make install</span> |
The above will output:
<span class="line">1</span> |
<span class="line">Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20121212/</span> |
If there is an error (that I encountered):
<span class="line">1</span> |
<span class="line">cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@17000#: Operation not permitted</span> |
It means you need to disable SIP first (see above for how to disable SIP)
Modify /etc/php.ini and add extension=mcrypt.so
Restart apache
<span class="line">1</span> |
<span class="line">sudo apachectl restart</span> |
Look at your phpinfo(); mcrypt information will appear;
(My blog original text: http://www.jmolboy.com/2015/12/01/mcrypt-extension-on-EI-Capitan/)