Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @php instead of php in composer.json #412

Merged
merged 3 commits into from Jun 30, 2017
Merged

Use @php instead of php in composer.json #412

merged 3 commits into from Jun 30, 2017

Conversation

rndmh3ro
Copy link

The composer post-install scripts use a hardcoded php to run scripts.
I have two different versions of php installed (5 & 7):

root@localhost:/var/www/monica# php -v
PHP 5.6.30-0+deb8u1 (cli) (built: Feb  8 2017 10:31:58) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
root@localhost:/var/www/monica# /usr/bin/php7.0 -v
PHP 7.0.20-1~bpo8+1 (cli) (built: Jun 10 2017 20:21:39) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.20-1~bpo8+1, Copyright (c) 1999-2017, by Zend Technologies

Now if I run /usr/bin/php7.0 composer.phar install, composer will be run with php7.0 but the scripts will run with php5 since that is what gets called when I run php instead of /usr/bin/php7.0.
This PR fixes that in the way that now the php process being currently used will execute the scripts, not a new process.

See the docs of composer:

To execute PHP scripts, you can use @php which will automatically resolve to whatever php process is currently being used:

Sebastian Gumprich and others added 3 commits June 28, 2017 22:03
The composer post-install scripts use a hardcoded `php` to run scripts.
I have two different versions of php installed (5 & 7):
```
root@localhost:/var/www/monica# php -v
PHP 5.6.30-0+deb8u1 (cli) (built: Feb  8 2017 10:31:58)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
```
```
root@localhost:/var/www/monica# /usr/bin/php7.0 -v
PHP 7.0.20-1~bpo8+1 (cli) (built: Jun 10 2017 20:21:39) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.20-1~bpo8+1, Copyright (c) 1999-2017, by Zend Technologies
```

Now if I run `/usr/bin/php7.0 composer.phar install`, composer will be run with php7.0 but the scripts will run with php5 since that is what gets called when I run `php` instead of `/usr/bin/php7.0`.
This PR fixes that in the way that now the php process being currently used will execute the scripts, not a new process.

See the docs of composer:

> To execute PHP scripts, you can use @php which will automatically resolve to whatever php process is currently being used:
- https://getcomposer.org/doc/articles/scripts.md#executing-php-scripts
@djaiss
Copy link
Member

djaiss commented Jun 30, 2017

Thanks for this. I didn't know about it. I'll merge this.

@djaiss djaiss merged commit 319c111 into monicahq:master Jun 30, 2017
@rndmh3ro rndmh3ro deleted the composer_use_atphp branch June 30, 2017 07:11
@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2021
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.

None yet

2 participants