I used to think that the internal web server which SYMFONY uses is part of APACHE server, which runs with the following command:
$ php bin/console server:start
But as I turn off the Apache server on my PC (windows 10) the internal web server still producing without any problems, so is it that the internal web server has nothing to do with the Apache server or it's something unusual?
PHP provides a standalone built-in web server.
You can try it by running php -S localhost:3000 -t web at the root directory of your project then browsing http://localhost:3000/app_dev.php.
All commands that are part of the server:* namespace are related to the PHP built-in server.
For more informations, look at the command directly.
it is using PHP build in server
Related
I'm using this library to add websockets to my codeigniter app. I got everything to work, but I need the websocket server to always run in the background, regardless of the CLI being open or not.
To run the server in the CLI, I run this command:
php index.php welcome index
Which gives me:
Running server on host 0.0.0.0:8282
Authentication activated
Websockets works on my app, but if I close the CLI, the server closes as well. How do I keep this running? I have Supervisor (as suggested for Ratchet), but I have no idea where to go from here. I'm just running a simple PHP server (Ubuntu on AWS Lightsail), not a node one, bytheway.
I have a PHP web server powered by Nginx,HHVM and Lumen, when I start the server using this command : php artisan serv --port="8081" --host"x.x.x.x"
it will start and running perfectly for a while like two weeks max!
then it will die and not responding anything! It's not on heavy load of requests. I don't know if it's HHVM related issues or Lumen problem?!
php artisan serve is the development way of things. when you start your affirmation and say that you have a NGINX server and then say that you are using the dev server build in Laravel it's way to wrong. You need to configure NGINX to serve the Lumen app with it (example of linux server, nginx and lumen). I hope the example will clear your vision on this situation.
I'm trying to run a simple Laravel project inside a Vagrant (VirtualBox) VM. The guest is Ubuntu 14.04 x64, and the host is Windows 7 x64. I've set up port forwarding (8000 on host to 8000 on guest), but when I run php artisan serve, though I get a message stating that the server is running on port 8000, when I visit localhost:8000 on my host machine, Chrome tells me 'this webpage is not available'. There are two complications:
First, if I use curl from inside the VM, I receive the correct page contents - so it appears the server is working fine.
Second, if I run a Python web server using python -m SimpleHTTPServer on the same VM, I can access it fine on my host OS. Visiting localhost:8000, I see the directory contents listed. So it appears the port forwarding is working fine.
I tried deleting the public/.htaccess file in the Laravel project, to no avail. I'm no PHP expert, and this problem is hard to Google! Any pointers would be appreciated.
After reading this question I tried
php artisan serve --host 0.0.0.0
And it works fine now.
Does the PHP built in web server allow multiple instances/sites?
Background on the project skeleton
I am working through Zend for the first time via Chrisopher Valles' tutorial.. with a slight difference. He uses Vagrant to instantiate a VBox instance, and I'm working locally in Ubuntu 12.x LTS...
https://github.com/christophervalles for more details on the Vagrant box...
I want to utilize the internal PHP 5.5 server if possible, but getting an error when (of course) running the 2nd call.
Is the best/usual solution to have the core service be on some variable port when in development, and run the web client on port 80?
I'd, of course, need to rewrite some of my client's code to point to the new port, but would the Zend Service need a rewrite anywhere? I'd say no.
Starting up my site's core/api services Zend project :
>php -S 0.0.0.0:8080 -t public/ public/index.php
PHP 5.5.10-1+deb.sury.org~precise+1 Development Server started at Day Date Time
Listening on http://0.0.0.0:8080
Document root is /home/core_site/public
Press Ctrl-C to quit.
Starting up my site's web client, that talks to the first server:
>php -S 0.0.0.0:8080 -t public/ public/index.php
[Day Date] Failed to listen on 0.0.0.0:8080 (reason: Address already in use)
you could just use a different port
php -S 0.0.0.0:8081 -t public/ public/index.php
Thanks for reading my book!
About your question, Andrew is right about using a different port. As far as I know you cannot do domain name based hosts on the built in php server. If you don't want to use different ports each time you should look into using apache or nginx.
If you go with nginx and php you can re-use the config files I use for the Vagrant machine so you don't have to do everything from scratch. Essentially the OS on the Vagrant machine is a Ubuntu 12.04 (the same as yours) so shouldn't be hard to re-use the configs :D
You can check out the php.ini and the nginx vhosts used on Vagrant here.
Cheers!
How can I see the Laravel view without an artisan command CLI. I don't have CLI from my hosting provider, I only have access to FTP, to run Laravel I have to use this command in CLI:
php artisan serve --port=8080 --host=0.0.0.0
How can I get the view without this command?
Thanks.
php artisan serve is not ment for use in production environments because it uses PHP5 build in webserver. If you're with a hosting provider, they probably run Apache and you can just serve your app via Apache.
Have a look at the documentation on php.net if you want to know more about the build in webserver.
PHP applications will stall if a request is blocked.
This web server was designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network.