Symfony2 with embedded PHP 5.4 server

I am trying to work with Symfony2 with the new PHP 5.4 and its built-in server. I downloaded Symfony2 and unzipped it on my server and added this router.php file, like the one mentioned here :

<?php if (isset($_SERVER['SCRIPT_FILENAME'])) { return false; } else { require 'Symfony/web/app.php'; } ?> 

The web server itself works because if I replace router.php with something simple, like phpinfo(); , it outputs it correctly, but with the specified router.php script the site remains white / blank. If I open developer tools, it returns 500 Server error .

I start the server as follows:

 /home/php54/php -S 0.0.0.0:88 router.php 

In my shell, I have no error message output.

+6
source share
2 answers

/ home / php54 / php -S 0.0.0.0:88 router.php

You are trying to start the server on a privileged port, so either change the port or run it as a privileged user (not recommended).

Also you changed the router script, and I think you messed up with the file paths. You did not specify docroot in your command, so your current directory is your docroot (so this should be your project web directory). But then the path to the front controller in router.php is wrong ( Symfony/web/app.php ).

You must carefully follow the instructions from my blog post. So:

  • change the current directory to the project web directory /
  • download the router script: wget https://raw.github.com/gist/1507820/b9583ab7f7f5e0e4e29806c38c6c361220b6468f/router.php ,
  • start the server: php -S 0.0.0.0:8000 router.php .

That should work.

You can also try the patch from my pull request , which adds a simple command that just starts the embedded PHP server.

+7
source

I don't have a convenient php 5.4 environment, but load app_dev.php instead of app.php, since the debug will be set to true and errors will be reported.

0
source

Source: https://habr.com/ru/post/909847/


All Articles