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

Installation fails due to specifying an absolute path: '/usr/bin/php' #714

Closed
Viveur opened this issue Oct 28, 2014 · 8 comments
Closed
Assignees

Comments

@Viveur
Copy link

Viveur commented Oct 28, 2014

Current Behaviour

MCrypt Extension is loaded as part of MAMP's PHP (phpinfo.php confirms this).

MAMP's version of PHP is specified in my $path

Running 'which php -v' returns MAMP's version of PHP.

However as Magento's installer calls /usr/bin/php it forces the use of OS X's built-in version of PHP which does not have the extension loaded.

/usr/bin/php -f '/Users/me/Documents/DATA/WWW/magento2/dev/shell/maintenance.php' -- --set='1' 2>&1

This results in the error:

[ERROR] exception 'Exception' with message 'exception 'Exception' with message 'Module 'Magento_Core' depends on 'mcrypt' PHP extension that is not loaded.' in /Users/[name]/Documents/WWW/magento2/lib/internal/Magento/Framework/Module/DependencyManager.php:56

Suggested Behaviour

Install script should possibly use the the system's preferred version of PHP rather than specifying an absolute path.

@maksek
Copy link
Contributor

maksek commented Oct 28, 2014

Hi @bit32, you are describing very specific configuration for OS X, looks like you have 2 versions on php installed. You may remove your /usr/bin/php and make symlink to MAMP php in /usr/bin/. Or install the same extensions for your default installation of php. If you will use macports, there is php_select port, which do the same - replacing /usr/bin/php with your preferred.
We going to consider possible solutions how to make installer universal to different systems, but we are focusing on supported OS. If you have possible universal solution - feel free to contribute and publish pull request.

@Viveur
Copy link
Author

Viveur commented Oct 28, 2014

Sure, thanks.

I just mentioned it as MAMP is fairly popular and that error hasn't been mentioned before.

Totally understand that you are focused on getting other things working first tho.

@Vinai
Copy link
Contributor

Vinai commented Oct 28, 2014

It is quite common to have PHP installed in a location different from /usr/bin/php.
The common approach I see (and have used) is to call
/usr/bin/env php -finstead of calling php directly.

@buskamuza
Copy link
Contributor

We actually don't hard-code path to PHP, so it's not always /usr/bin/php. We're searching for PHP executable using \Symfony\Component\Process\PhpExecutableFinder::find(), looks like it takes into account different options. But, still, it may happen that PHP CLI is different from PHP for Web.
Right now we're make some changes to eliminate some of such calls at all, while some of them will be still there.

@aohorodnyk
Copy link
Contributor

Hello,

You can set to variable environment const with name PHP_PATH and value "path to you php execution file" or you can remove your local php from MAC OS and set your php from MAMP like default php version.
PhpExecutableFinder has more variables which you can use. If you want, you can see it in code

P.S. how to set environment const http://stackoverflow.com/questions/146354/setting-php-variables-in-httpd-conf

Thanks

@maksek maksek added the PS label Nov 12, 2014
@verklov
Copy link
Contributor

verklov commented Nov 18, 2014

@bit32, we'd like to hear from you. Did the advice by @dropsql help you resolve the issue you were having?

@Viveur
Copy link
Author

Viveur commented Nov 18, 2014

I symlinked MAMPs version of PHP to /usr/bin/php to get it installed at the time. @dropsql's comment wasn't added for another 2 weeks.

Since you asked tho I have downloaded the latest version of Magento2 and have run through two fresh installations of Magento 2 with the symlink removed (entering /usr/bin/php -v at the terminal returns OS X's inbuilt version of PHP).

The first I did by manually setting a environment variable of PHP_PATH to the MAMP path as described by @dropsql. The installation process went ahead without error.

I then unset the environment variable with: unset launchctl unsetenv PHP_PATH and attempted a new installation. I was somewhat surprised to find that the installation process also worked without error. Not sure if this is due to updated code in Magento2 or some persistent change on my end.

@muasir
Copy link

muasir commented Jan 23, 2015

This issue was present when we used exec. Now we don't use exec, so this shouldn't be a problem.

@muasir muasir closed this as completed Jan 23, 2015
okorshenko pushed a commit that referenced this issue Oct 12, 2015
magento-engcom-team added a commit that referenced this issue Jun 21, 2019
#714

 - Merge Pull Request magento/graphql-ce#714 from vovsky/graphql-ce:486-add-customer-account-validation-in-quote-operations
 - Merged commits:
   1. f91224e
   2. 65c6327
   3. 0a68474
   4. a8ea439
   5. d983e25
   6. 7fc5494
   7. 0890aa8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants