localhost:8000 failed to load - php

I cannot load the webpage of my laravel when I try to put in my URL localhost:8000. It gives me the following error :
Failed to load resource: net::ERR_EMPTY_RESPONSE
GET http://localhost:8000/ net::ERR_EMPTY_RESPONS
The last time I used laravel, it worked fine but now when I load it to browser, it doesn't work anymore. Screenshot below.

you need to remove chrome extensions and then try again and see if it works.

Try the command, php -S 0.0.0.0:80 -t ~. Make sure you are Superuser, so if you're on UNIX, type sudo before the command. php -S runs a server on 0.0.0.0:80. 0.0.0.0 means to run the server on localhost on all interfaces on port 80. Port 80 is the default web port that is accessed by web browsers. -t ~ means to use the directory ~ for hosting. You could actually replace ~ with any directory with an index.php in it.

Related

Is it possible to use browser-sync as a proxy to watch for PHP files?

I have a xampp php server running at port 8080. Is it possible to do something like this
browser-sync start --proxy "localhost:8080" --files "*.php" "css/*.css" "js/*.js"
It works, in that localhost:8080 is proxied but the page doesn't refresh when I edit the PHP code

How to set a domain name with php artisan serve

I am new to PHP and Laravel. While virtualhosting with Wamp, I could specify the documentroot, servername and the port number - hence specifying the domain name. But with the command php artisan serve, I am able to specify the port address but not the domain name.
Is it possible to set the domain name?
also, what is the difference between hosting with this command and with wamp ?
n.b I am new to server side languages, sorry for asking these basics !
EDIT: I've used php artisan serve --host=blog.local --port=8001 but error is showing up
I've cleared the configuration and application cache.
You can explicitly define the host and the port with artisan serve command:
php artisan serve --host=somedomain.com --port=8001
Note: Remember to enable to port with your firewall.
Though it is too late.
Make an entry in the system host file. in case of windows it is at
C:\Windows\System32\Drivers\etc\hosts
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 blog.local
Then run your command:
php artisan serve --host=blog.local --port=8001
It's easy, just pass the --host parameter.
php artisan serve --host=example.com
Try to command like this:
php artisan serve --host=<host IP address> --port=<port to use>
Example:
php artisan serve --host=127.0.0.1 --port=8080
First of all you will need to add your local domain in the host file. The path is C:\Windows\System32\drivers\etc and you will found the host file.
Open with notepad and write this line 127.0.0.1 <your_domain_name> to the last line. For example 127.0.0.1 lala.com
Then the command on your terminal,
php artisan serve --host=<your_domain_name_in_the_host_file>
and system will auto generate a port number for you like
php artisan serve --host=lala.com
Laravel development server started: http://lala.com:8000
Now then, you are able to surf your localhost, which is http://lala.com:8000 with your custom domain name but also with the port number.
If you want a custom port number then just specify the port number at the end of the command,
php artisan serve --host=lala.com --port=8088
and url will be http://lala.com:8088
Try this command.
php artisan serve --host=0.0.0.0 --port=8000
You can try it:
php artisan serve --host 192.168.0.1 --port 80
Change your host and port

How to enable PHP's built-in web server on wercker

I have setup my wercker.yml file with the following step midway:
- script:
name: Serve application
code: php -S localhost:8000 >> /dev/null &
That appears to run, however, in another step when I try cURL to http://localhost:8000 I get the following:
curl: (7) Failed to connect to localhost port 8000: Connection refused
It does it for all ports, not just 8000. Has anyone else managed to get PHP's in built server working in wercker, or open any ports?
Assuming you're using the wercker CLI and trying to set up a development pipeline, you need to use wercker dev with the --publish 8000 argument. This will forward the traffic from your host on port 8000 to the container on port 8000.
Also, if you're using boot2docker, you can't specify localhost, since boot2docker spins up a VM that runs docker. In that case you'll need to use your boot2docker IP, which you can find by running the boot2docker ip command.

How to reach Laravel without /public/index.php

I'm following the official Laravel course (currently the first chapter "Meet Composer,"), but I can't seem to get it right. In the course I was instructed to enter in the command line:
php -S localhost:8888 -t public
and I should be able to reach the URL: "http://localhost:8888/learning-laravel-5", but this gives me a 404 error.
But if I put in this URL I get to see the frontpage, as it should: http://localhost:8080/learning-laravel-5/public/index.php
My question is, how can I see the frontpage as instructed in the video, following the provided URL: http://localhost:8888/learning-laravel-5 ?
I have looked through the duplicate questions on stackoverflow but I can't find a solution to this problem.
Edit: I have tried to get my absolute path by doing pwd, its says "/media/sf_sandbox/laracast-4.2", I now have done this: "php -S localhost:8888 -t /media/sf_sandbox/laracast-4.2/public". I now go to localhost:8888 but it still doesn't work.
It says my documentroot is /media/sf_sandbox/learning-laravel-5/public
If you are running below command from the project root learning-laravel-5 , than localhost:8888
it self points to the learning-laravel-5/public folder
php -S localhost:8888 -t /var/www/html/learning-laravel-5/public
In this case only localhost:8888 should work and you don't need to append learning-laravel-5 after that.
It seems like you are using XAMP..because
For XAMP, localhost port is 8000 And
For XAMP, localhost port is 8000.
in the laravel directory, where you ran composer, type php artisan serve. This will run an internal webserver, which opens up 8000 port by default. Once you have that, open your browser and access http://localhost:8000
If that works, you have an issue with your MAMP configuration.
If it is MAMP, check the following
1) make sure you set the document root to the /public directory in your laravel installation.
2
make sure you have enabled rewrite module in your mamp.
Checkout How to get htaccess to work on MAMP

How to know which port php5 is using I forgot the port number I used to install

I did not use PHP but had to install it for ganglia setup but could not access the php on calling localhost it shows IT Works .How do I know what is the port number .
The default port for HTTP is 80, so if in your browser you are using http://localhost and says "It works!" means it is working on port 80.
PHP is not a web server, you are probably using Apache. You can find its configuration files in /etc/apache2 folder. Look for apache2.conf, httpd.conf or ports.conf and find a line like "Listen (Port Number)"

Categories