Getting code and phpunit to work with MAMP with OS X Lion

Running:

  • MAMP 2.0.5
  • PHP 5.3.6 (bundled with MAMP)
  • Mac OS X Lion 10.7.2

My goal is to get a Codeception structure to work and use in my MAMP project. I follow the instructions here on how to install it.

The pear is installed and working fine. I can get a Codeception with these commands:

$ pear channel-discover codeception.com/pear $ pear install codeception/Codeception 

After installation, when I try to run encoding commands, I get the following error:

 Warning: require_once(Codeception/autoload.php): failed to open stream: No such file or directory in /usr/bin/codecept on line 12 Fatal error: require_once(): Failed opening required 'Codeception/autoload.php' (include_path='.:') in /usr/bin/codecept on line 12 

I think the problem is caused by either:

  • Conflict between installing MAMP PHP bundled with OS X
  • Problem with include_path in my php.ini or somewhere else

Also interesting

  • When I run the $ phpunit from inside my project folder, I get -bash: phpunit: command not found , but if I run it like $ /Applications/MAMP/bin/php/php5.3.6/bin/phpu nit , it works fine .
  • I expect that in /Applications/MAMP/bin/php/php5.3.6/bin/ will be a codecept file, but it is not there - in the /Applications/MAMP/bin/php/php5.3.6/lib/php folder /Applications/MAMP/bin/php/php5.3.6/lib/php is
Codeception I tried several different ways to install it, and I assume that one of the ways to install Codeception in Lion is copying php (unlike MAMP) - so I have a codecept file in /usr/bin/ as well as a Codeception folder in /usr/lib/php/pear/

For reference:

  • PHP lives here: /Applications/MAMP/bin/php/php5.3.6/bin/php
  • Pearls live here: /Applications/MAMP/bin/php/php5.3.6/bin/pear
  • PHPUnit lives here: /Applications/MAMP/bin/php/php5.3.6/bin/phpunit

Any help? Suggestions?


Thanks to the help of Davert - I was able to confirm that this is a conflict with the MAMP copy of the embedded copy of PHP and Lion. To solve the problem, I created a new php.ini file in /etc , which was a duplicate of php.ini.default and changed the include_path to /Applications/MAMP/bin/php/php5.3.6/lib/php

+4
source share
2 answers

I think the problem is that your PEAR command was executed from within PHP. So your primary PHP MAMP libraries in (/Applications/MAMP/bin/php/php5.3.6/bin/pear) not been updated. I suggest you find the second PEAR, because Codeception has been persistently saved. And add the path to it in include_path in php.ini.

Yes, PEAR is pretty buggy. In future releases, the Composer installer will be added.

Alternatively, you can try using the Phar executable.

In this case, Codeception should be executed with:

 php codecept.phar 
+3
source

One solution that worked for me was editing / Applications / MAMP / bin / php 5.3 / bin / codecept and replacing / usr / bin / php on the first line with / Applications / MAMP / bin / php5.3 / bin / Php

0
source

Source: https://habr.com/ru/post/1392806/


All Articles