As macOS is built off of BSD, not Linux so you just need to setup Apache, MySql and PHP
Step 1 # Apache is already install on your Mac. This following command requires root to run so you’ll actually run it like this:
sudo apachectl <cmd>
To start server
sudo apachectl start
To stop server
sudo apachectl stop
To restart server
sudo apachectl restart
Step 2 # MySQL does not come installed on the macOS. so you’ll have to install it. You can easily install it useing homebrew. Run the following command to install MySql:
brew install mysql
Now get familiar with some basic MySQL commands:
To start
mysql.server start
To restart
mysql.server restart
To stop
mysql.server stop
Step 3# Installing PHP
Install PHP 7.3
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.3
Install PHP 7.2
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2
Install PHP 7.1
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
Install PHP 5.6 – Running with OSX 10.11 El Capitan or lower versions.
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
Verify installation:
export PATH=/usr/local/php5/bin:$PATH
and run the following command
php -v