How to run PHP

on a mac locally

Scott
1 min readMay 5, 2020

Apache and PHP come installed automatically on all Macs.

Run Apache

sudo su-
apachectl start

Test it by opening a browser and putting in http://localhost.

then put a php file in your document root folder

go to your root of your apache server

cd /Library/Webserver/Documents

Then

sudo nano test.php

Then write to your php file.

<?php 
echo "Hello world we did it! Booyakasha!";
?>

Then open up your browser.

--

--

No responses yet