Question

I've hit a roadblock with my phpunit functional tests. The AWS SDK requires APC, for some reason I can't get phpunit to load the extension. I'm not sure where I'm going wrong. The CLI is using the same ini file as MAMP

Gregs-MacBook-Pro:HvH-PHP greg$ php --ini
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.3.6/conf
Loaded Configuration File:         /Applications/MAMP/bin/php/php5.3.6/conf/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
Gregs-MacBook-Pro:HvH-PHP greg$ 

I've also attempted to add the ini file into app/phpunit.xml.dist

<php>
    <ini name="mamp" value="/Applications/MAMP/bin/php/php5.3.6/conf/php.ini"/>
    <server name="KERNEL_DIR" value="app/" />
</php>

Error message in CLI

PHP Fatal error:  Call to undefined function apc_fetch() in /vendor/aws-sdk-for-php/lib/cachecore/cacheapc.class.php on line 58

EDIT: Some more test as per comments In CLI I can run a test script with apc_fetch(); and it works successfully.

Running php -m also shows APC as an installed module

Any suggestions as to what else I should try?

Was it helpful?

Solution

I could propose you 2 solutions:

  1. Create a symlink of /Applications/MAMP/bin/php/php5.3.6/conf/php.ini to /private/etc/php.ini

  2. Modify phpunit execution file and append -c /Applications/MAMP/bin/php/php5.3.6/conf/ to the php run command. Also - check if correct php binary is used. If it is not - change to the correct path first and check if issue has been fixed

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top