John Davidson

macos - Why does cake/Console/cake.php use a different PHP version than the one set in the terminal?

0 comments
Message:


I have now tried everything imaginable.


The following problem occurs:


In the terminal PHP runs in version PHP 7.4.12 from MAMP.


php -v output:


PHP 7.4.12 (cli) (built: Nov 30 2020 13:28:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

When I output the path with which php I get this output:


 ❯ which php
/Applications/MAMP/bin/php/php7.4.12/bin/php

If I now in my CakePHP project in the cake.php php phpinfo(); me using cake/Console/cake.php output, I get the PHP


phpinfo()
PHP version => 7.3.24-(to be removed in future macOS)

I have as far as possible the php version for the CLI modified. This in all imaginable files. In ~/.zshrc the path is: export PATH=/Applications/MAMP/bin/php/php7.4.12/bin:$PATH. Which was also confirmed with which php.


My System:



  • MacOS Big Sur Version 11.2.3

  • MAMP Pro Version 6.3

  • CakePHP 2.10.24



My Answer:
7.3.21

This discrepancy may be due to the fact that the cake.php script is using a different PHP executable or configuration than the one set in your terminal. You may need to check the shebang line at the top of the cake.php script to see which PHP executable it is using. Additionally, you can try setting the PHP version explicitly in the cake.php script or adjusting the PATH variable to ensure that the correct PHP executable is being used.

Rate this post

4 of 5 based on 4528 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us