DEV Community

Monique Dingding
Monique Dingding

Posted on

Installing PHP and PECL extensions on MacOS

Installing memcache and memcached gives me this error:

Alt Text

This is due to permission issues in your local machine. To fix this, just manually create the folder that the script cannot:

$ pecl config-get ext_dir 
/usr/local/lib/php/pecl/20190902
Enter fullscreen mode Exit fullscreen mode

Copy the value returned by the command and then run:

$ mkdir -p {paste clipboard value}
Enter fullscreen mode Exit fullscreen mode

Then install the pecl extensions you need:

$ pecl install memcached
Enter fullscreen mode Exit fullscreen mode

Happy coding!

Top comments (1)

Collapse
 
leslieeeee profile image
Leslie

Have you tried ServBay.dev?
It's a much easier tool for PHP developers, providing a user-friendly experience, especially for beginners. It supports all versions of PHP, MariaDB, PostgreSQL, as well as Redis and Memcached. You can run multiple PHP instances simultaneously and switch between them effortlessly. It also offers easy updates without the need to configure environment variables. This tool has greatly simplified my PHP development and is definitely worth trying!