I have a PC with windows 8.1 and XAMPP v3.2.1 and it includes PHP 5.6.
I followed these steps from: http://symfony.com/doc/current/cookbook/web_server/built_in.html
php app/console server:run x.x.x.x:8000
The issue is, I can't run my symfony app in a web server, the error is:
Built in server terminated unexpectedly
If I launch this command: php app/console server:run, everything is ok:
Server running on http://127.0.0.1:8000
And this: php app/console server:run 0.0.0.0:8000 => OK
My application isn't accessible with my local IP address.
I almost sure you're defining an invalid IP address.
You must define or loopback address (localhost or 127.0.0.1) or your machine IP on local network (i.e: 192.168.25.7).
Also, if want more details on what is going on, run command passing "-vvv" (most verbose level):
$ bin/console -vvv server:run 192.168.25.6:8000
Related
I would like to configure PHPStorm so that I can run Artisan commands directly from my IDE's terminal. For example php artisan key:generate. However, when I do, I receive the error 'php' is not recognized as an internal or external command.
Background:
running Windows 10 as host machine
using Docker to run my webserver (Nginx) and PHP interpreter (7.2-fpm).
I followed this tutorial.
https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose.
One thing the tutorial didn't cover was how to set up my remote PHP CLI interpreter. For that, I followed https://www.jetbrains.com/help/phpstorm/configuring-remote-interpreters.html and can make a successful connection as it picks up the correct PHP version 7.2.21 as seen in the screenshot.
After this, I restarted my Windows 10 host machine, fired up the container, opened my IDE and tried to run php -v from the terminal but hit the error again.
I know it has something to do with my PATH environment variable being set incorrectly, or not at all but I am not sure how to point it to the container's PHP interpreter. Any help would be greatly appreciated.
EDIT
For what it is worth, I know that I can exec into the container and run PHP commands from there, but thought I might be able to do it directly from my host machine by pointing to the container's interpreter.
The terminal in PHPstorm is the same as any other terminal on your computer. It doesn't automatically connect to docker to run the php -v command. If you want to run php from PHPstorm in docker you can right click the file:
Choose run:
And select your created docker interpreter as your runtime:
If the fix button doesn't show it can be configured through:
settings > Languages & Frameworks > PHP
And then clicking on the 3 dots at the end of "CLI interpreter"
I installed a fresh copy of Symfony on my localhost at htdocs\symfony-fresh and the file structure is:
Now I run the following in git bash:
$ php bin/console server:run
then I was suggested to browse at 127.0.0.1:8000 to see the fresh installation of symfony. It works like a charm. But one day later I browse at 127.0.0.1:8000 and I can see the following error message:
This site can’t be reached
127.0.0.1 refused to connect.
It seems server is offline. I checked my apache & Mysql is running.
Then I tried to run the command again:
$ php bin/console server:run
But same problem is going on. I am new in Symfony and enjoying to learn, but this problem stuck me. What should I do to run this app browsing at 127.0.0.1/symfony-fresh or localhost/symfony-fresh?
You should check status follow:
php bin/console server:status
By default, the web server listens on port 8000 on the loopback device. You can change the socket passing an IP address and a port as a command-line argument:
# passing a specific IP and port
php bin/console server:start 192.168.0.1:8080
# or like this
php bin/console server:start *:8080
Apache has nothing to do with this, the built in Symfony server is based on php built in server (php -S ...)
The built in server is intended for development use only, you must run the command every time the server has stopped or the machine has rebooted.
If you want to use Symfony with apache you can setup a virtualhost: https://symfony.com/doc/current/setup/web_server_configuration.html
I'am using Symfony and Laravel on same machine.
I'am on developement, and I have no webserver, I use the local server of each of them.
For Symfony, that works :
$ cd /var/www/symfony
$ php bin/console server:start
[OK] Server listening on http://127.0.0.1:8000
For Laravel, that does not work :
$ cd /var/www/laravel
$ php artisan serve
Laravel development server started: <http://127.0.0.1:8000>
[Thu Oct 12 21:46:21 2017] Failed to listen on 127.0.0.1:8000
When I stop the Symfony, then the Laravel works. There is a conflict between the 2 tools.
I am obliged to have the 2 working, because there is a REST-API on my Lavavel site and my symfony site is a client of this API.
How can I run the 2 sites with local development server, without installing a webserver ?
Your problem is that you can not share the same port on the same host.
I don't know Laravel, but I know Symfony. With Symfony you can change the port of the local server with this command :
php bin/console server:stop
php bin/console server:start 127.0.0.1:8080
After this command, you can try to restart your Laravel server, and you will have :
Symfony on url http://127.0.0.1:8080
Laravel on url http://127.0.0.1:8000
Use below command for run laravel project.
php artisan serve --port=8888
Using this command you can run laravel project in a different port.
I am using windows 10 and wamp server and I am fresh installing laravel and all i get is this error message and is it necessary to do php artisan serve everytime i open laravel ? as long as i close cmd prompt localhost:8000 refused to connect .
Php artisan serve error
I think you are running a Laravel project blog by command php artisan serve and you are browsing your application by localhost:8000 or 127.0.0.1:8000
Your screenshot saying that when you are trying to visit a url which is not defined in your routes/web.php then, you are getting invalid request (Unexpected EOF) error in your cmd.
And of course! in this case when you close cmd then your Laravel app will not run.
So now, if you don't want to run your Laravel app by the following command each time, then you can use Laragon in windows environment.
Either you have to run php aritsan serve or set up a virtual host in your OS. Here is how to set up a virtual host in Ubuntu 16.04: How To Set Up Apache Virtual Hosts on Ubuntu 16.04
This is case, you can keep your cmd open. And open another cmd, redirect to file path where you are working and it should work fine.
What is the procedure to install my app symfony 2.7 in ubuntu VPS with a domain for example www.myapp.com without a port
the documentarion is this:
$ cd my_project_name/
$ php app/console server:run
Then, open your browser and access the http://localhost:8000/app/example URL to see the Welcome page of Symfony:
but, they dont say nothing about how it is installed on a server such as apache for example, width a virtualhost
Please help!!
app/console server:run command for only development purpose
You need to configure web server for this
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html