-4

No matter what php extention i install with sudo pecl install xxx, i was failed and got the following error tips:

enter image description here

Is there anyone who had the same problem ?

Yang Zhou
  • 15
  • 5
  • You are trying to write in `/usr/include/...` but **System Integrity Protection** does not allow that on a Mac https://support.apple.com/en-gb/HT204899 – Mark Setchell Jul 23 '18 at 19:19
  • Thanks a lot.So how to change the path to avoid this problem?Or maybe I should install PHP extensions compiled. – Yang Zhou Jul 24 '18 at 17:15
  • Personally, I use **homebrew** to install PHP https://stackoverflow.com/a/50529784/2836621 – Mark Setchell Jul 24 '18 at 18:17

1 Answers1

-1

You must run this as root if you want to install it in that location. If you cannot elevate your rights, then you need to install it elsewhere or ask your admin to do that for you.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • Thanks for your answer. I do run the command with the `root` user on my personal computer. But I failed. I even used the `chown` command to change the group to which I belonged. – Yang Zhou Jul 23 '18 at 18:16
  • Error message: ERROR: failed to mkdir /usr/include/php/ext/msgpack – Yang Zhou Jul 23 '18 at 18:17
  • the error may indicate that either you do NOT run this as root, or that the `mkdir` is run without `-p` option so one/more of elements of target path does not exist and `mkdir` fails. – Marcin Orlowski Jul 23 '18 at 18:21