Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

Fix - Fail to serve with built-in server as instructed #430

Merged
merged 3 commits into from
Nov 15, 2019

Conversation

peterleephp
Copy link
Contributor

Error at line 25:

$ php -S 0.0.0.0:8080 -t public/ public/index.php

Error in logging output:

PHP 7.0.28-0ubuntu0.16.04.1 Development Server started at Mon Mar 26 09:42:37 2018
Listening on http://0.0.0.0:8080
Document root is /home/userj/My/repos/ZendFrameworkRibs/ZF3/helloworld/public
Press Ctrl-C to quit.
[Mon Mar 26 09:42:53 2018] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Mon Mar 26 09:42:53 2018] PHP Fatal error:  Unknown: Failed opening required '/home/userj/My/repos/ZendFrameworkRibs/ZF3/helloworld/public/public/index.php' (include_path='.:/usr/share/php') in Unknown on line 0

Error at line 25:
```
$ php -S 0.0.0.0:8080 -t public/ public/index.php
```
Error in logging output:
```
PHP 7.0.28-0ubuntu0.16.04.1 Development Server started at Mon Mar 26 09:42:37 2018
Listening on http://0.0.0.0:8080
Document root is /home/userj/My/repos/ZendFrameworkRibs/ZF3/helloworld/public
Press Ctrl-C to quit.
[Mon Mar 26 09:42:53 2018] PHP Warning:  Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Mon Mar 26 09:42:53 2018] PHP Fatal error:  Unknown: Failed opening required '/home/userj/My/repos/ZendFrameworkRibs/ZF3/helloworld/public/public/index.php' (include_path='.:/usr/share/php') in Unknown on line 0

```
@michalbundyra
Copy link
Member

@peterleephp I think we should go just with php -S 0.0.0.0:8080 -t public/.

See also: zendframework/zend-expressive-skeleton#216

…and format: 'php [options] -S <addr>:<port> [-t docroot] [router]'
@peterleephp
Copy link
Contributor Author

peterleephp commented Mar 26, 2018

@webimpress thanks for the reference, I have also updated the serve script in compser.json so composer run --timeout=0 serve will actually start working.
I'd prefer php -S 0.0.0.0:8080 -t public/ index.php over php -S 0.0.0.0:8080 -t public, because it will be more explicit as suggested by php --help :

Usage: php [options] [-f] <file> [--] [args...]
   php [options] -r <code> [--] [args...]
   php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
   php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
   php [options] -S <addr>:<port> [-t docroot] [router]
   php [options] -- [args...]
   php [options] -a

  -a               Run interactively
  -c <path>|<file> Look for php.ini file in this directory
  -n               No configuration (ini) files will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse and execute <file>.
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -r <code>        Run PHP <code> without using script tags <?..?>
  -B <begin_code>  Run PHP <begin_code> before processing input lines
  -R <code>        Run PHP <code> for every input line
  -F <file>        Parse and execute <file> for every input line
  -E <end_code>    Run PHP <end_code> after processing all input lines
  -H               Hide any passed arguments from external tools.
  -S <addr>:<port> Run with built-in web server.
  -t <docroot>     Specify document root <docroot> for built-in web server.
  -s               Output HTML syntax highlighted source.
  -v               Version number
  -w               Output source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.

  args...          Arguments passed to script. Use -- args when first argument
                   starts with - or script is read from stdin

  --ini            Show configuration file names

  --rf <name>      Show information about function <name>.
  --rc <name>      Show information about class <name>.
  --re <name>      Show information about extension <name>.
  --rz <name>      Show information about Zend extension <name>.
  --ri <name>      Show configuration for extension <name>.

@michalbundyra
Copy link
Member

@peterleephp Believe me, we tried different version before and we have always issues with them on different systems or different PHP version, what I suggested above and linked is the latest version we agreed on, which is working on all OS and latest PHP versions as there described.

…licit 'router' parameter for wider compatibility.
@peterleephp
Copy link
Contributor Author

Ok, I believe you @webimpress, updated the pull request.

My search does show trace of issues on this PHP command on different OS over the time:
#147
zendframework/zend-expressive#42
zendframework/tutorials#71
#406

Copy link
Member

@michalbundyra michalbundyra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

weierophinney added a commit that referenced this pull request Nov 15, 2019
Fix - Fail to serve with built-in server as instructed

Conflicts:
	composer.json
weierophinney added a commit that referenced this pull request Nov 15, 2019
@weierophinney
Copy link
Member

Thanks, @peterleephp. Merged to develop for release with 3.1.0.

@weierophinney weierophinney merged commit 5cc7533 into zendframework:master Nov 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants