I'm trying to work with Symfony2 with the new PHP 5.4 and its built-in server. I downloaded Symfony2 and unziped it on my server and added this router.php file like mentioned here:
<?php
if (isset($_SERVER['SCRIPT_FILENAME'])) {
return false;
} else {
require 'Symfony/web/app.php';
}
?>
The webserver itself works because if I replace router.php
with something simple like phpinfo();
it outputs it correct but with the mentioned router.php
script the site remains white/blank. If I open developer tools it returns 500 Server error
.
I start the server like that:
/home/php54/php -S 0.0.0.0:88 router.php
On my shell I have no output of a error message.
Built-in web server ¶ This web server is 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.
You will now see some feedback in your terminal letting you know that your PHP server is listening for traffic on http://mysite.local:8080. To stop the server simply hit Ctrl+C in your running terminal.
PHP server is a collection of fundamental tools that make it easy to host at local servers so you can develop or built Web Apps at your computer. If you're are doing development on web application, having a PHP server is perfect way, the most perfect way to start.
/home/php54/php -S 0.0.0.0:88 router.php
You are trying to run server on privileged port, so either change port or run this as privileged user (not recommended).
Also you have modified router script and I think you've messed up with file paths. You are not specifying docroot in your command, so your current directory is your docroot (so it should be your project's web/ directory). But then path to the front controller in router.php is wrong (Symfony/web/app.php
).
You should really follow carefully instructions from my blog post. So:
wget https://raw.github.com/gist/1507820/b9583ab7f7f5e0e4e29806c38c6c361220b6468f/router.php
,php -S 0.0.0.0:8000 router.php
.This should work.
You can also try patch from my pull request which adds simple command that just runs built-in PHP server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With