3

I am facing the following issue after upgrading to El Capitan. It says:

Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20121212/
cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@826#: Operation not permitted

while running sudo make install in mcrypt/php-5.6.13/ext/mcrypt folder. I think this is due to SIP but what is the other way round.

What is SIP and how do I know if it's causing this error?

2

Yes, this is due to SIP. So the two options you have are

  • disable SIP entirely
  • raise a defect/support request against mcrypt to use /usr/local instead of /usr for installation
  • I'm facing the same problem, what's SIP and how do I disable it? – Joaquín L. Robles Oct 5 '15 at 15:01
  • Please use the search field on top right – nohillside Oct 5 '15 at 16:36
6

After reading @user980575's response (which is a bit redundant with directories) and a comment on Coolest Guide's On The Planet's post regarding this subject (which requires manually editing your ./configure script) I came up with an alternative solution. Overriding the EXTENSION_DIR on the fly.

It took a little trial and error but when you're ready to actually perform the install after phpizing (is that a word?) simply make the directory:

mkdir -p /usr/local/lib/php/extensions

And then run:

./configure

make

sudo make EXTENSION_DIR='/usr/local/lib/php/extensions' install

Now that the extension is placed in a non-protected directory you just have to update your php.ini to point to the extension with the full path.

extension=/usr/local/lib/php/extensions/mcrypt.so
3
+50

El Capitan adds a new security feature named System Integrity Protection (SIP). Among other things, SIP prevents parties other than Apple from adding, deleting or modifying directories and files stored in certain directories:

/bin
/sbin
/usr
/System

Apple has indicated that the following directories are available for developers to access:

/usr/local
/Applications
/Library
~/Library

All directories in /usr except for /usr/local are protected by SIP.

For more information on SIP, please see this post:

https://derflounder.wordpress.com/2015/10/01/system-integrity-protection-adding-another-layer-to-apples-security-model/

0

There is no need to disable System Integrity Protection to install php extensions. Just create a suitable directory in /usr/local, and use the INSTALL_ROOT variable. e.g.

% mkdir -p /usr/local/php56_ext

and in your extension directory:

% INSTALL_ROOT=/usr/local/php56_ext make install

You will need to activate the extension using the full path, so in your php.ini, you will need the line:

extension=/usr/local/php56_ext/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .