Home >Backend Development >PHP Tutorial >Guide to installing PHP on Mac

Guide to installing PHP on Mac

Lisa Kudrow
Lisa KudrowOriginal
2024-12-12 11:46:31901browse

PHP is a widely used programming language for web development. You can install PHP on your Mac by following the steps below

Guide to installing PHP on Mac

1. Install Homebrew: Use Homebrew, the package manager for macOS. Open the Terminal app and run the command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This command will download and install Homebrew on your Mac.

2. Install PHP using Homebrew: After installing Homebrew, use it to install PHP by running the following command:

brew install php

This will install it on your Mac Latest version of PHP.

3. Check PHP version: Verify the installed PHP version by running the following command:

php -v

This will display the PHP version on your Mac.

4. Configure PHP: If required, you can configure PHP to suit your requirements by editing the php.ini file. Find the php.ini file location by running the following command:

   php --ini

Open the file with a text editor and make the necessary changes.

5. Start the PHP server: Start the PHP server on port 8000 by running the following command:

php -S localhost:8000

Open a web browser and go to http:// localhost:8000 to view your PHP application.

The above is the detailed content of Guide to installing PHP on Mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn