{"action":"created","issue":{"url":"https://api.github.com/repos/composer/composer/issues/5957","repository_url":"https://api.github.com/repos/composer/composer","labels_url":"https://api.github.com/repos/composer/composer/issues/5957/labels{/name}","comments_url":"https://api.github.com/repos/composer/composer/issues/5957/comments","events_url":"https://api.github.com/repos/composer/composer/issues/5957/events","html_url":"https://github.com/composer/composer/issues/5957","id":194658127,"number":5957,"title":"Pass current PHP_BINARY to composer scripts","user":{"login":"ArminVieweg","id":1275298,"avatar_url":"https://avatars.githubusercontent.com/u/1275298?v=3","gravatar_id":"","url":"https://api.github.com/users/ArminVieweg","html_url":"https://github.com/ArminVieweg","followers_url":"https://api.github.com/users/ArminVieweg/followers","following_url":"https://api.github.com/users/ArminVieweg/following{/other_user}","gists_url":"https://api.github.com/users/ArminVieweg/gists{/gist_id}","starred_url":"https://api.github.com/users/ArminVieweg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArminVieweg/subscriptions","organizations_url":"https://api.github.com/users/ArminVieweg/orgs","repos_url":"https://api.github.com/users/ArminVieweg/repos","events_url":"https://api.github.com/users/ArminVieweg/events{/privacy}","received_events_url":"https://api.github.com/users/ArminVieweg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-09T17:56:09Z","updated_at":"2016-12-11T15:14:29Z","closed_at":null,"body":"On some server configurations I need to use a different php binary than `php`. On german provider Mittwald for example you have to use `php_cli` on command line.\r\n\r\nI want to trigger some binaries in scripts section in composer.json. Those binaries are served by some dependencies and are written in php. So they've got a shebang like `#!/usr/bin/env php` and are executable.\r\n\r\nHere is an example of such a script call:\r\n```\r\n\"scripts\": {\r\n        \"post-autoload-dump\": [\r\n            \"bin/example abc123\"\r\n        ]\r\n    },\r\n```\r\nWhat composer does is executing this script (./bin/example) on shell. So even if I call \r\n\r\n```\r\nphp_cli composer.phar dump\r\n```\r\n\r\nComposer calls the script with `./bin/example`, which will use `php` instead of `php_cli` (because of missing prepending php binary and shebang which defined to use `php`).\r\n\r\nSo my idea (and feature request) is to add the possibility to prepend current PHP_BINARY in scripts section to script calls. The example above could look like this, then:\r\n\r\n```\r\n\"scripts\": {\r\n        \"post-autoload-dump\": [\r\n            \"{$php-binary} bin/example abc123\"\r\n        ]\r\n    },\r\n```\r\nAnd if composer passes `PHP_BINARY` to this variable I am able to use the same configuration on different environments. Because locally I've got `php` available on cli and I really don't want to update composer.json for each environment.\r\n\r\nSo I hope you like my idea of this additional php-binary variable. In that case I would try to provide a pull request :)\r\n\r\nThanks in advance\r\nArmin"},"comment":{"url":"https://api.github.com/repos/composer/composer/issues/comments/266287653","html_url":"https://github.com/composer/composer/issues/5957#issuecomment-266287653","issue_url":"https://api.github.com/repos/composer/composer/issues/5957","id":266287653,"user":{"login":"Seldaek","id":183678,"avatar_url":"https://avatars.githubusercontent.com/u/183678?v=3","gravatar_id":"","url":"https://api.github.com/users/Seldaek","html_url":"https://github.com/Seldaek","followers_url":"https://api.github.com/users/Seldaek/followers","following_url":"https://api.github.com/users/Seldaek/following{/other_user}","gists_url":"https://api.github.com/users/Seldaek/gists{/gist_id}","starred_url":"https://api.github.com/users/Seldaek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Seldaek/subscriptions","organizations_url":"https://api.github.com/users/Seldaek/orgs","repos_url":"https://api.github.com/users/Seldaek/repos","events_url":"https://api.github.com/users/Seldaek/events{/privacy}","received_events_url":"https://api.github.com/users/Seldaek/received_events","type":"User","site_admin":false},"created_at":"2016-12-11T15:14:29Z","updated_at":"2016-12-11T15:14:29Z","body":"> Why not using PHP_BINARY?\r\n\r\nBecause it's only available on 5.5+ (IIRC). But the PhpExecutableFinder returns PHP_BINARY if it is defined.\r\n\r\nAnyway I'll add `@php` support as it's easy enough and should help in such cases where you have non-standard PHP binaries."}}
{"actor":{"display_login":"Seldaek"}}