Created
October 16, 2017 21:11
-
-
Save ramsey/3ebe9ecae9973ba05ba9c5463c099434 to your computer and use it in GitHub Desktop.
Segfault when running built-in PHP web server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
public function execute($log) | |
{ | |
file_put_contents($log, "this is a log\n", FILE_APPEND); | |
} | |
} | |
(new Foo())->execute('./mylog.txt'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php foo.php | |
$ cat mylog.txt | |
this is a log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php -S localhost:8000 | |
PHP 7.1.3 Development Server started at Mon Oct 16 17:07:16 2017 | |
Listening on http://localhost:8000 | |
Document root is /home/ramsey/foo | |
Press Ctrl-C to quit. | |
[Mon Oct 16 17:07:38 2017] ::1:56424 [200]: /foo.php | |
[1] 53968 segmentation fault php -S localhost:8000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For reference, I don't get a segfault with the script using PHP 7.1.8 on macOS 10.12.6 (compiled from Homebrew).