Home >Backend Development >PHP Tutorial >OS X EI Capitan installation mcrypt, capitanmcrypt_PHP tutorial

OS X EI Capitan installation mcrypt, capitanmcrypt_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:02:141040browse

OS X EI Capitan installs mcrypt, capitanmcrypt

OS X EI Capitan installs mcrypt ​ (Original text of my blog: http://www.jmolboy.com/2015/12/01/mcrypt-extension-on-EI-Capitan/) ​ December 01, 2015 Published in php extension

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

What the hell

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

  • /System
  • /sbin
  • /usr
  • Does not contain (/usr/local/)

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

Ban SIP

So the solution is to disable the SIP protection mechanism. The steps are:

  • Restart the system
  • Hold Command R
  • Menu "Utilities" ==>> "Terminal" ==>> Enter csrutil disable; after execution, it will output: Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.
  • Restart the system again

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

Full installation

<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/)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1086206.htmlTechArticleOS X EI Capitan installs mcrypt, capitanmcrypt OS X EI Capitan installs mcrypt (My blog original text: http:// www.jmolboy.com/2015/12/01/mcrypt-extension-on-EI-Capitan/)December 01, 2015 Published in...
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