Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start a PHP server on Mac OS X

Tags:

php

macos

server

I am figuring out how to use PHP OpenId

I have cloned the repo to the ~/www directory. There are some examples in the php-open-id/examples directory which I wanted to run.

Specifically, I wanted to render the page php-open-id/examples/consumer/index.php in order to better understand the API. I started a server in the php-open-id/examples directory using

python -m SimpleHTTPServer 8000 

and I navigated to localhost://consumer/index.php

But it didn't work. It shows a dialog box to save the file. What is the correct way to render this PHP file?

like image 664
user3425344 Avatar asked Nov 12 '15 09:11

user3425344


People also ask

Does macOS have PHP?

PHP is bundled with macOS since macOS X (10.0.


2 Answers

I have found a solution :

Run the server using

php -S localhost:9000 
like image 134
user3425344 Avatar answered Oct 13 '22 21:10

user3425344


Mac OS

Just Visit your project folder

open terminal on that folder

and Run php -S localhost:9000

then you can see

PHP 7.3.24-(to be removed in future macOS) Development Server started at Tue Mar 30 11:58:49 2021 Listening on http://localhost:9000 

After that you are able to access your application on http://localhost:9000 if your port is not available try to change port

like image 33
abhinavxeon Avatar answered Oct 13 '22 23:10

abhinavxeon