Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Conversation

mnapoli
Copy link
Contributor

@mnapoli mnapoli commented Apr 11, 2014

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

If you use Vagrant, you can use PHP's built-in webserver like so:

app/console server:run 0.0.0.0:8000

With Vagrant port-forwarding you can access the application at http://localhost:8000/. The 0.0.0.0:8000 makes PHP listen to IP addresses other than 127.0.0.1.

However app_dev.php will forbid access to any IP other than 127.0.0.1, which makes it unusable.

This is a simple fix to allow access to app_dev.php when running on PHP's built-in webserver.

@fabpot fabpot merged commit e7a14a3 into symfony:master Apr 23, 2014
fabpot added a commit that referenced this pull request Apr 23, 2014
This PR was merged into the 2.4-dev branch.

Discussion
----------

Allow access to app_dev.php whith PHP's dev webserver

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

If you use Vagrant, you can use PHP's built-in webserver like so:

```
app/console server:run 0.0.0.0:8000
```

With Vagrant port-forwarding you can access the application at http://localhost:8000/. The `0.0.0.0:8000` makes PHP listen to IP addresses other than 127.0.0.1.

However `app_dev.php` will forbid access to any IP other than `127.0.0.1`, which makes it unusable.

This is a simple fix to allow access to `app_dev.php` when running on PHP's built-in webserver.

Commits
-------

e7a14a3 Allow access to app_dev.php whith PHP's dev webserver
@mnapoli mnapoli deleted the patch-1 branch April 23, 2014 07:22
Copy link

Choose a reason for hiding this comment

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

Shouldnt this be !== 'cli-server'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@staabm I think you missed the ! at the beginning of the line.

! (in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')

is the same as:

(!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
&& (php_sapi_name() !== 'cli-server')

Copy link

Choose a reason for hiding this comment

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

Oh rigt.. Didnt got the braces right

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