How to run PHP locally on MacOS

OSX comes with php installed :

$ which php # => /usr/bin/php

So you can run your php file. But don’t forget to include your code between <?php ... ?>.

// test.php
<?php
echo("Hello world")
?>

So now you can run in your terminal:

$ php test.php
$ Hello world%

Apache is not needed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)