DEV Community

Asrar
Asrar

Posted on

4

Mac os x install Xdebug with multiple PHP versions

If you have brew installed with multiple PHP versions i.e. 7.1, 7.2 and 7.3 on Mac OS X mojave, you can to do the following:

  1. Install autoconf with brew brew install autoconf.

  2. Change to the PHP version that you want Xdebug on, run brew unlink php@7.1 && brew link --force --overwrite php. This will switch from PHP 7.1 to PHP 7.3.

  3. Download the latest Xdebug source from xdebug website.

  4. Extract the Xdebug tar and navigate to extracted directory, where you'd see all the files.

  5. Run phpize to configure the build for the new Zend engine.

  6. Run ./configure.

  7. Run make.

  8. Xdebug extension xdebug.so gets compiled in modules directory.

  9. Create a new directory path under /usr/local/lib/php/7.3.1/extensions/ and copy xdebug.so to this location. Here, 7.3.1 is the current version that I switched earlier, change this to match your PHP version.

  10. Open php.ini in an editor and enter
    zend_extension="/usr/local/lib/php/7.3.1/extensions/xdebug.so" then save the change.

  11. Run php -v and it will show Xdebug has been configured correctly.

If you want to configure Xdebug on another PHP version then just repeat from step 2 all the way to 11. As mentioned in earlier post, this way you don't need to disable/enable System Integrity Protection on Mac OS X.

Tiugo image

Modular, Fast, and Built for Developers

CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.

Start now

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!

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Explore this insightful post in the vibrant DEV Community. Developers from all walks of life are invited to contribute and elevate our shared know-how.

A simple "thank you" could lift spirits—leave your kudos in the comments!

On DEV, passing on wisdom paves our way and unites us. Enjoyed this piece? A brief note of thanks to the writer goes a long way.

Okay