user2997418
user2997418

Reputation: 658

Running PHP server without port

I have a typo3 folder in /var/www/my_folder, I want to run php server inside my_folder,

I run php -S localhost:8080 but I have problems later with URLs, I want get rid of :8000. when I try php -S localhost I get

Invalid address: localhost

How can I manage this ?

Upvotes: 0

Views: 3492

Answers (2)

edcs
edcs

Reputation: 3879

You can run the PHP web server on on port 80, which is the default for HTTP, like this:

php -S localhost:80

Then you can visit http://localhost in your web browser.

However, it's common practice to use a different port for local development so that you don't have any conflicts between your dev environment and anything else which may be running on your machine. If you're sure you're not using port 80 anywhere else, feel free to use it.

What you can't do is omit the port number like you have in your second example.

Upvotes: 5

SREagle
SREagle

Reputation: 251

Without explicite port usage, browsers use port 80 for HTTP and 443 for HTTPS. So if you want your URLs you use 'later' to not include the port, start the PHP interpreter with the one you need the URLs for.

Upvotes: 0

Related Questions