Skip to content

How do you get php working on Mac OS X?

To get PHP working on Mac OS X, you can follow these steps:

  1. Check if PHP is already installed by running the command php -v in the terminal. If it is already installed, you can skip to step 4.
  2. Install PHP using Homebrew, the standard package manager for macOS, by running brew install php in the terminal. (Alternatively, download official macOS binaries from https://www.php.net/downloads.php).
  3. Verify the installation by running php -v again to confirm the new version.
  4. Test the installation by creating a file called "test.php" in any directory with the following contents:

Getting the php information in local machine

php
<?php
    phpinfo();
?>
  1. Start a local server by running php -S localhost:8000 in the directory containing test.php, then navigate to http://localhost:8000/test.php in your browser to see the PHP information page.

Note: This is a basic example and the exact steps may vary depending on the version of PHP and macOS you are using.

Dual-run preview — compare with live Symfony routes.