{"action":"created","issue":{"url":"https://api.github.com/repos/swooletw/laravel-swoole/issues/62","repository_url":"https://api.github.com/repos/swooletw/laravel-swoole","labels_url":"https://api.github.com/repos/swooletw/laravel-swoole/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/swooletw/laravel-swoole/issues/62/comments","events_url":"https://api.github.com/repos/swooletw/laravel-swoole/issues/62/events","html_url":"https://github.com/swooletw/laravel-swoole/issues/62","id":325704324,"number":62,"title":"app()->runningInConsole() true on HTTP request","user":{"login":"megawubs","id":2302867,"avatar_url":"https://avatars2.githubusercontent.com/u/2302867?v=4","gravatar_id":"","url":"https://api.github.com/users/megawubs","html_url":"https://github.com/megawubs","followers_url":"https://api.github.com/users/megawubs/followers","following_url":"https://api.github.com/users/megawubs/following{/other_user}","gists_url":"https://api.github.com/users/megawubs/gists{/gist_id}","starred_url":"https://api.github.com/users/megawubs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megawubs/subscriptions","organizations_url":"https://api.github.com/users/megawubs/orgs","repos_url":"https://api.github.com/users/megawubs/repos","events_url":"https://api.github.com/users/megawubs/events{/privacy}","received_events_url":"https://api.github.com/users/megawubs/received_events","type":"User","site_admin":false},"labels":[{"id":742140944,"url":"https://api.github.com/repos/swooletw/laravel-swoole/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-23T13:25:50Z","updated_at":"2018-05-23T13:33:55Z","closed_at":null,"author_association":"NONE","body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n1. Please provide your PHP and Swoole version. (`php -v` and `php --ri swoole`)\r\nPHP 7.2.5 (cli) (built: Apr 26 2018 12:07:32) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\r\n    with Zend OPcache v7.2.5, Copyright (c) 1999-2018, by Zend Technologies\r\n\r\nswoole\r\n\r\nswoole support => enabled\r\nVersion => 1.10.5\r\nAuthor => tianfeng.han[email: mikan.tenny@gmail.com]\r\nkqueue => enabled\r\nrwlock => enabled\r\nasync http/websocket client => enabled\r\npcre => enabled\r\nzlib => enabled\r\n\r\nDirective => Local Value => Master Value\r\nswoole.aio_thread_num => 2 => 2\r\nswoole.display_errors => On => On\r\nswoole.use_namespace => Off => Off\r\nswoole.fast_serialize => Off => Off\r\nswoole.unixsock_buffer_size => 8388608 => 8388608\r\n\r\n\r\n2. Please provide your Laravel/Lumen version.\r\nLaravel v5.5.40\r\n\r\n\r\n3. Which release version of this package are you using?\r\nv2.3.8\r\n\r\n\r\n4. What did you do? If possible, provide a recipe for reproducing the error.\r\n```\r\napp()->runningInConsole()\r\n```\r\n\r\n\r\n5. What did you expect to see?\r\n`false`\r\n\r\n\r\n6. What did you see instead?\r\n`true`\r\n\r\nSomehow, php thinks it's running from a cli program as `php_sapi_name()` returns `cli` when executed during a http request. This is in essence true as the server is started from a cli command. But can't we somehow tell PHP that we're not running in cli, but from `swoole` or something else?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/swooletw/laravel-swoole/issues/comments/391348221","html_url":"https://github.com/swooletw/laravel-swoole/issues/62#issuecomment-391348221","issue_url":"https://api.github.com/repos/swooletw/laravel-swoole/issues/62","id":391348221,"user":{"login":"albertcht","id":9117929,"avatar_url":"https://avatars3.githubusercontent.com/u/9117929?v=4","gravatar_id":"","url":"https://api.github.com/users/albertcht","html_url":"https://github.com/albertcht","followers_url":"https://api.github.com/users/albertcht/followers","following_url":"https://api.github.com/users/albertcht/following{/other_user}","gists_url":"https://api.github.com/users/albertcht/gists{/gist_id}","starred_url":"https://api.github.com/users/albertcht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/albertcht/subscriptions","organizations_url":"https://api.github.com/users/albertcht/orgs","repos_url":"https://api.github.com/users/albertcht/repos","events_url":"https://api.github.com/users/albertcht/events{/privacy}","received_events_url":"https://api.github.com/users/albertcht/received_events","type":"User","site_admin":false},"created_at":"2018-05-23T13:33:55Z","updated_at":"2018-05-23T13:33:55Z","author_association":"MEMBER","body":"Hi @megawubs ,\r\n\r\nSwoole server can only run in CLI environment. Do you have any special reason to do that?"}}
{"actor":{"display_login":"albertcht"}}