Search code examples
phpphpunitioncube

PHPUnit and ionCube conflict


I get this error when I try to run test cases that need ionCube: The file path/to/file.php has been encoded with the ionCube PHP Encoder and requires the free ioncube_loader_lin_5.4.so ionCube PHP Loader to be installed. Fatal error occurred in test case Class_Name->testCaseName. TearDown for fatal-error-failed-test and tearDownAfterClass were successfully called after fatal error occurred.

I have PHPUnit 4.5.0.

ionCube is installed correctly as I can see it with phpinfo() and the website is working.


Solution

  • PHPUnit may be using a different php.ini file than your website, so you'll see the ionCube Loader on a webpage generated by <?php phpinfo();.

    To confirm, type in php -i to see the CLI version of phpinfo() (or php -i | grep -i ioncube to see if the ionCube Loader is installed, and php -i | grep "Loaded Configuration File" to see where your CLI PHP configuration file lives).

    Do note that PHPUnit may be using a completely different php.ini file still - you'll have to look into your own setup for more details.

    Once you've located the configuration file, you should be able to copy and paste the zend_extension line from your working php.ini file, provided you have the same PHP setups for both CLI and CGI.

    If you're stuck and/or it's still not working, you can also create a ticket at ionCube's Helpdesk.