Home > Backend Development > PHP Tutorial > Guide for Installing PHP on Mac

Guide for Installing PHP on Mac

PHP中文网
Release: 2024-12-12 10:00:04
forward
641 people have browsed it

PHP, a widely-used programming language for web development, can be installed on your Mac following these steps

截屏2024-12-12 09.51.25.png

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

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

This command downloads and installs Homebrew on your Mac.

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

brew install php
Copy after login

This installs the latest version of PHP on your Mac.

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

php -v
Copy after login

This displays the PHP version on your Mac.

4. Configure PHP: If needed, configure PHP to meet your requirements by editing the php.ini file. Find the php.ini file location by running:

   php --ini
Copy after login

Open the file with a text editor for necessary changes.

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

php -S localhost:8000
Copy after login

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

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

Related labels:
source:dev.to
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template