PHPUnit and ionCube conflict - php

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.

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.

Related

Understanding why PHP does not load an extension

I've compiled PHP from source (5.5.7), as well as the memcached extension (2.2.0). I've installed memcached and the extension is correctly installed in /usr/local/lib/php/extensions/no-debug-non-zts-20121212 (there is the memcached.so file) and my php -i tells me that the extension directory is correct : extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20121212
PHP runs correctly simple files, but when I load an app using memcached, the PHP error log file tells me only PHP Fatal error: Class 'Memcached' not found but I have no more details.
When I run php -m, there is no memcached module listed.
How can I find out why memcached is not loaded by PHP ?
For the record, it's not enough that there is a memcached.so file in the extension_dir of PHP. PHP also needs to extension to be explicitly loaded in the php.init file.
Solved it with the following command
echo 'extension=memcache.so' >> /usr/local/lib/php.ini

Symfony3 report generation (html) of PHPUnit does not work

I want to generate a report with PHPUnit: sudo phpunit --coverage-html ./phpunit-report src/ but I get the following error: Error: No code coverage driver is available. After some research on web I found that I've to enable the PHP extension xdebug and I do so in the file /opt/lampp/etc/php.ini on line: zend_extension="/usr/lib/php5/20131226/xdebug.so" After doing it so, I realize that the extension is enable as I can see it on symfony toolbar:
But when I try to see the xdebug extension using CLI :php -m | grep xdebug I get null. Same thing with php -i | grep xdebug. Then at that point I really don't know whether the extension has not been enabled properly or ... any help please. Notice that when I load phpinfo() I also see the xdebug extension like this:
You need to activate Xdebug for the CLI SAPI. That binary uses a separate PHP configuration file (php.ini), not the one used by the webserver.

How To Use APC with MAMP PHP Command Line?

I am trying to execute a php file with a specific MAMP php version(/Applications/MAMP/bin/php/php5.3.14/bin/php) . But even though I have enabled APC caching while starting MAMP, apc code are getting error like "Fatal error: Call to undefined function apc_fetch()" . in general running of that script from browser via 'localhost' works fine.
I have also tried by adding 'apc.so' to php.ini file for that php version. But this is generating another error 'Segmentation fault: 11' .
What can I do to get the APC running under that php cli version please? Thanks.
MAMP uses a different php.ini for CLI. Here's how to find it:
$ php -i | grep php.ini
Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.5.10/conf
Loaded Configuration File => /Applications/MAMP/bin/php/php5.5.10/conf/php.ini
In this case you should edit /Applications/MAMP/bin/php/php5.5.10/conf/php.ini and uncomment:
;extension=apcu.so
EDIT: make sure php is the MAMP php and not system php! In doubt use:
$ /Applications/MAMP/bin/php/php5.5.10/bin/php -i | grep php.ini

NuSphere remote debugger dbg-php-5.3.so says it's not installed

just getting into php. Trying to get NuSphere remote debugging working. I am coming from VS background so i like that NuSphere is c compiled and not java.
Ok so if you use NuSphere maybe you can help me. I've dumped the dbg-php.5.3.so file in my extensions directory. I've modified my php.ini file:
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20090626/dbg-php-5.3.so"
[debugger]
debugger.enabled=on
debugger.profiler_enabled=on
the file is found.. except when i restart the webserver and run phpinfo (from my user account on a WHM/Cpanel server) the module does not show as being loaded??
I am using the trial version.. not sure if that matters.
This is what I did:
Login to SSH and type php -i | grep php.ini
This will give you the path to the php.ini file you need to edit, on this system it happens to be /usr/local/lib/php.ini (Running CentOS 6 x86_64 with WHM/cPanel).
Edit /usr/local/lib/php.ini and search "extension_dir" which will give you the path to place dbg-php-5.3.so, on this system it happens to be /usr/local/lib/php/extensions/no-debug-non-zts-20090626. Add the .so file there and continue to modify your php.ini file with the debugger options.
To test the the debugger is being loaded I restart httpd "service httpd restart" and then "php -v" to verify the extension loaded properly.
I hope this helps!

PHP Zend Debugger configuration

Hi i am new to php, I currently learning php using eclipse. I know i have to install the zend debugger my php.ini store at c:windows i had added in these line:
[Zend]
zend_extension=c:/php/ext/ZendDebugger.dll
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always
zend_debugger.connector_port=10013
but on command prompt i tried php -m it shown that i never install zend debugger. I not sure where goes wrong I check phpinfo also never show any zend information.
I had lots of problems making the debugger work. Now I'm using the ZendServer CE which is free and the configuration is a lot easier.
Also I use Eclipse + PDT, downloaded from Zend Site.
This should work right out of the box. Why not using ZendServer? you get everything you want in a package.
On a browser go to:
http://localhost/?phpinfo=1
look for "Loaded Configuration File"
and take a note of the path
Now open a DOS prompt window (Start > Run > (type) cmd)
and at the command line type
c:\path\to\your\php\php.exe -r phpinfo(); |more
(press CTRL+C to break)
Again look for:
"Loaded Configuration File"
and take a note of this path.
It could be that you are using a different php.ini for your webserver and for the CLI version.
You will need to add the config changes to both php.ini files or put the config in a file called zend.ini and place that in the folder that is mentioned in your phpinfo output under:
"Scan this dir for additional .ini files"
I have experienced the same thing when I was using thread-safe PHP on Windows.
Up to date versions of the Zend Debugger no longer support running in thread-safe flavors of PHP on Windows. Switching to a non-thread-safe (a.k.a nts) flavor of PHP fixed this issue for me.
See here: http://forums.zend.com/viewtopic.php?f=59&t=1918#p13729

Categories