Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for dev server embedded in PHP >= 5.4 #1348

Closed
trustmaster opened this issue May 20, 2014 · 7 comments
Closed

Add support for dev server embedded in PHP >= 5.4 #1348

trustmaster opened this issue May 20, 2014 · 7 comments
Labels
Milestone

Comments

@trustmaster
Copy link
Member

PHP >= 5.4 comes with a built-in web server which is easy to use for development when you don't need a real webserver on your computer.

Pros:

  • Just run php -S localhost:8888 in a project's directory and your project is up. Ctrl+C to shut it down.
  • Easily portable between devices.
  • No need to setup Apache/nginx.

Cotonti already installs and runs with the embedded webserver, but SEF URLs don't work yet. This is to be solved.

@trustmaster
Copy link
Member Author

Done. Usage (in console):

cd your/project/directory
php -S localhost:8888

Replace 8888 with any port you like. Note: change $cfg['mainurl'] in datas/config.php if you want to serve an existing project.

@ghost
Copy link

ghost commented Jun 6, 2014

On php 5.3 shows a blank page. Perhaps the problem in this line:
$REQUEST_FILENAME = mb_substr(explode('?', $_SERVER['REQUEST_URI'])[0], 1);

@trustmaster
Copy link
Member Author

@devkont, yes, exactly, this is PHP 5.4 syntax. Should be:

$tmp = explode('?', $_SERVER['REQUEST_URI']);
$REQUEST_FILENAME = mb_substr($tmp[0], 1);

@trustmaster trustmaster reopened this Jun 6, 2014
@trustmaster
Copy link
Member Author

But php_sapi_name() shouldn't return cli-server on PHP 5.3.

@ghost
Copy link

ghost commented Jun 6, 2014

But the error in the syntax of all will be determined (on PHP 5.3).

@trustmaster
Copy link
Member Author

@devkont thanks! Fix committed.

@macik
Copy link
Member

macik commented Jul 1, 2014

Not working in PHP 5.2.17 as used closures (line 24).

@macik macik reopened this Jul 1, 2014
macik added a commit that referenced this issue Jul 1, 2014
Replaces closure with lambda for use with PHP 5.2.*
@macik macik closed this as completed Jul 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants