Is ioncube loader working in my case? - php

I used Putty to install ioncube loader. Used php -v to check and it shows
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.19, Copyright (c) 2002-2015, by ionCube Ltd.
However, I inserted a page with the following code in my website to check:
<?php
phpinfo();
?>
but it doesn't show that ioncube loader is enabled.
I also used:
<?php
echo var_export(extension_loaded('ionCube Loader') ,true);
and it returned false.
My Server API is CGI/FastCGI so I have already included
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.4.so
in the following file /etc/php5/cgi/php.ini
I wonder if it's really working or not?

A common mistake over time is having a different major PHP version for CLI and the web server, so perhaps your website does not use PHP 5.4. Another gotcha is using a different php.ini for website and cli, or having a php.ini in the same location as a web request that, on a cgi system, overrides that main php.ini. The web server software or fastcgi pool in this case may also need to be restarted.

First of all, go to your terminal and type which php this will show you the directory of the particular php.ini file that is currently being used by the php installed on your computer.
Open the php.ini file and make you have added this line zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.4.so before any other Zend extension is loaded on the php.ini file.
Also note that the ionCube loader ioncube_loader_lin_5.4.so will only for PHP 5.4.* only.
Make sure you have copied the file into the directory you stated, you can verify by tying cd ~ and then sudo find /usr/local/ioncube/ioncube_loader_lin_5.4.so to make sure the file is situated there, if it is the terminal will return the file name showing it found it.
Now save the changes made on your php.ini file and run the command sudo apachectl restart (for Apache servers) to restart your server.
Test with php -v from your terminal again.
Hope this helps.

Related

How to enable php-debug in Atom?

I have installed php-debug in Atom + its IDE dependencies. When I set a breakpoint the debug view opens saying The debugger is not attached, but when I am trying to do so it seems as if Atom doesn't recognize I have php-debug package installed and asks me to install a debugger.
I read on some places there is a toggle debugging setting on the package, but I can't see that option.
I'm using Atom 1.27.0 and PHP 7.2.4:
PHP 7.2.4 (cli) (built: Apr 12 2018 02:49:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
with Zend OPcache v7.2.4, Copyright (c) 1999-2018, by Zend Technologies
I could provide Xdebug configuration but seems like the problem is on Atom itself? Did anyone have this problem?
very simple
Download xdebug from https://xdebug.org/download.php, TS version for Apache
Copy it to php/ext directory
Copy below text in php.ini below all other extensions
zend_extension="D:/wamp/php/ext/php_xdebug-2.6.1-7.2-vc15-x86_64.dll"
[xdebug]
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
Restart Apache and Find "xdebug" string in <?php phpinfo()?>
Install atom-debug_ui, php_debug
Package > PHP Debug > Toggle
Apply break-points and Run a PHP file from browser and that's it.
If it ask for paths remote http://localhost/DIRECTORY_PATH_TO_PHP_FILE
and local is directory path to PHP file.
I had the very same message few days ago …
Breakpoint were acually hit, I could see this because of the browser's tab loading icon, but nothing was happening on Atom user interface. All I could do was clicking stop or detach buttons which caused xdebug to end session and terminate browser tab load.
Using PHP7.2.7, Xdebug 2.6 (Docker php-fpm-alpine); Atom 1.26.1 x64
TLDR; PHP-debug extension couldn't process the "Path mappings" value I entered in the configuration panel.
Opening the dev console in Atom allowed me to spot an error accuring as the debugging session gets initiated in PHP Debug extension.
Atom Debug (PHP Debug) Session initiated
logger.js? [sm]:43 Atom Debug (PHP Debug) [TypeError: Cannot read property 'endsWith' of undefined
at Object.exports.generatePathMaps (/hom…]0: TypeError: Cannot read property 'endsWith' of undefined
at Object.exports.generatePathMaps (/home/me/.atom/packages/php-debug/lib/helpers.js:80:34)
at /home/me/.atom/packages/php-debug/lib/engines/dbgp/debugging-context.js:112:37
…
This led me to read at the Github repository and quickly figure what was going on.
All I had to do was changing the "Path mappings" text field value I erroneous filled in the first place. The text field expects a JSON string, as we can see HERE, the path mappings should be an iterable/array made of objects. It has to loook like this:
[{"localPath":"/home/me/projects/my-project","remotePath":"/var/www/my-project"}]
Add more mapping objects if you have more than one project. Note that this setting is reflected in ~/.atom/.config.cson
This fixed the issue, the debug view do not pop anymore saying there is no debugger attached.
I also had this problem, with Atom 1.53.0, PHP 7.3, and XDebug 2.9.8. I could tell from netstat that XDebug was connecting to Atom, but there was no activity in the PHP Debug tab, and no messages in the Console or PHP Console to give a hint of what was (or wasn't) going on.
Unlike Stphane, I didn't have any path maps defined. But taking a hint from his answer, I clicked on the "Path Maps" button in the PHP Debug tab. Then a series of error dialogs popped up, which I was able to solve one at a time.
In my case, the errors all happened because the project I'd checked out had some Unix symlinks in it, which Windows didn't know how to interpret. I solved them by removing the symlinks, and copying into their place copies of the files and directories they'd been pointing to. After that, the PHP Debug pane worked as expected - although the Debugger still says "No debuggers installed".
Atom Told me Debugger is not Attached but i made it work.
i saw atom php-debug tutorial but had problems like debugger is not Attached.
i want to share the configurations which that tutorial didn't includes:
Xdebug.ini autostart and idekey
first in the tutorial xdebug config. configs it to run automatic.
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
but its getting debugger run for every request. so you can make it off as this:
xdebug.remote_autostart=false
after that you have to tell debugger to send debug to atom`s api by appending this to xdebug config:
xdebug.idekey=xdebug-atom
if you use php-fpm, you have to reload it additional to restarting your http-server:
sudo systemctl reload php-fpm.service
Browser Extension with correct idekey parameter
after that install the browser plugin which attach a cookie to tell xdebug to made this request debuggable.
if your plugin hasnt Atom config,
in your browser extention preferences make this:
IDE key: xdebug-atom
Atom 2 plugins Enable and disable atom-ide-ui-feature-debug
and after that in Atom editor itself:
after installing atom-debug-ui and php-debug .
from Edit -> Preferences -> Package
select package atom-ide-ui package settings.
section Enable Features -> Enable Debugger
make it Never enabled .
like this:
https://github.com/gwomacks/php-debug/issues/310#issuecomment-419751273
True Break Points
now from Packages -> Debug -> Toggle Debugger
another note is when you want to make break point in atom. there are 2 types of break point. Big blue Dots and small blue dots.
only small ones work for debugger.
like here suggested:
https://learnwithdaniel.com/2019/06/atom-php-debugger/
Make remote path and local path identical
after setup request from browser. and Atom Asks you remote/local path.
make them identical

How to ensure XDebug is installed correctly?

I've downloaded the PHP version of Netbeans from here:
https://netbeans.org/downloads/
And I've pasted the output from phpinfo(); here:
https://xdebug.org/wizard.php
I followed their instructions:
Download php_xdebug-2.5.0-5.6-vc11.dll
Move the downloaded file to .\ext
Edit C:\php\php.ini and added the following line to the bottom of my .ini:
zend_extension = .\ext\php_xdebug-2.5.0-5.6-vc11.dll
Restart the webserver (IIS 7.5)
I copied that line and pasted it at the very bottom of my php.ini file. Does it belong somewhere else? Under the [PHP] section?
When I run NetBeans, I've opened my project and went to Properties -> Run Configuration -> Project URL and updated that to the correct path (http://localhost/myApplication/).
When I press Ctrl-F5 (Debug Project) a browser window opens with the following in the address bar:
http://localhost/myApplication/?XDEBUG_SESSION_START=netbeans-xdebug
So it looks like it's installed correctly, but if I set a breakpoint in my index.php file it doesn't trigger. I've tried setting other breakpoints throughout the software and those don't trigger, either.
I noticed in Netbeans, this progress bar just moves back and forth:
Should it be doing something?
EDIT Just doublechecked phpinfo(); and now I see this:
Zend Extension: 220131226
Zend Extension Build: API220131226,TS,VC11
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
report_zend_debug: on, on
So it seems like it's installed... What am I doing wrong?
And here's a screenshot of phpinfo();: https://i.stack.imgur.com/noSx4.png

Phalcon module loaded but still class can't be found

I have installed Phalcon on my vServer and it seems to be loaded,
but if I try to run website I get an error
PHP Fatal error: Class 'Phalcon\\Config\\Adapter\\Ini' not found in /home...
php -v
PHP 5.6.10 (cli) (built: Jun 11 2015 08:33:51)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
I followed the instructions on Phalcon website.
If I list php modules using php -m Phalcon is listed, I don't have
any errors, just don't know why it's not working!
Also, Phalcon is not listed on phpinfo(); page.
looks like you changed the config for the php console client but that config is not the same for the php module in apache.
Review what config is being loaded for apache module
When installing phalcon in order to get the extension working make sure to restart nginx / apache2, and if you are running PHP as a module php5-fpm service as well.
$ sudo service nginx restart
$ sudo service php5-fpm restart
I encountered the same problem and the reason is that I recompiled php with source code but not recompiled phalcon again after that. I solved that by compiling phalcon again with the correct phpize.
Sometimes when phalcon is installed, it creates a separate .ini file for itself and adds the extension therein. This is common in mac and linux OS. In such situation, type php --ini on the terminal. You should see an out put similar to the following...
Configuration File (php.ini) Path: /usr/local/etc/php/5.6
Loaded Configuration File: /usr/local/etc/php/5.6/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.6/conf.d
Additional .ini files parsed: /usr/local/etc/php/5.6/conf.d/ext-mongodb.ini,
/usr/local/etc/php/5.6/conf.d/ext-phalcon.ini
As you can see, phalcon created the /usr/local/etc/php/5.6/conf.d/ext-phalcon.ini file.
SOLUTION:
Open the file using sudo nano /usr/local/etc/php/5.6/conf.d/ext-phalcon.ini, copy the line in which the extension is loaded and paste in /usr/local/etc/php/5.6/php.ini if you are using XAMPP, copy the line to /Applications/XAMPP/xamppfiles/etc/php.ini Restart your server and check if that works.

Xdebug Error: "Failed loading xdebug.so: xdebug.so: cannot open shared object file: No such file or directory"

I recently installed xdebug on my server but restricted it's use to our test site, which uses it's own php.ini file.
For example, the test sites php.ini is located at:
/home/test_site/public_html/subdomain_name/php.ini
Inside this php.ini file I have the below for xdebug:
[XDebug]
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = /home/test_site/xdebug
xdebug.profiler_output_name = "cachegrind.out.%s-%u.%h_%r"
Now, the thing is, xdebug works fine, no problems.
However, on our main site, which also has it's own php.ini file, which is located for example at:
/home/main_site/public_html/php.ini
Inside this file I have nothing for xdebug in there.
Now, I recently setup a cron in cpanel for the main site such as:
php -f /home/main_site/public_html/cron_jobs/main_cron.php > /home/main_site/public_html/logs/main_cron.log 2>&1
Now, upon checking the output of the cron inside the log file I get the output:
Failed loading xdebug.so: xdebug.so: cannot open shared object file: No such file or directory
Why am I getting this error when the main site shouldn't even be loading xdebug?
Even though you have the two sites split up and using two different php.ini files, CRON will still use whichever php.ini file the PHP-CLI is configured to use. So, to figure out which php.ini CRON is using, this is the command to use:
php -i | grep php.ini
If PHP-CLI happens to be using a php.ini file that you didn't expect it to be using (such as /usr/local/lib/php.ini) then that will be the key to figuring out why you're seeing Xdebug errors in the logs.
It turns out that the /usr/local/lib/php.ini file had these two values set:
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"
zend_extension = "xdebug.so"
That was causing the error from the php script that was run by CRON (i.e. PHP-CLI) because zend_extensions need the full path to the module. This is also stated in the Xdebug documentation: http://xdebug.org/docs/install
So, to get rid of the error, just comment out that line (or just remove it). You could also comment out or remove the extension_dir line as long as you are not loading any other modules such as:
extension = memcached.so
Sometimes might be difficult from where the XDebug library is loaded since it can be done either by specifying the path in php.ini or by adding the lib in mods-available.
Firstly, run:
$ sudo grep 'xdebug' -r /etc/php/*
This will give you the files that loads the extension.
Now identify which php.ini is in use:
$ php -i | grep php.ini
This will give you the php version in use (in case you have multiple php versions). Now link the php version with the result from the first step.
Now, either you have to comment out the line where the xdebug extension is loaded or remove the xdebug.ini file (that loads the extension) from /etc/php/x.x/mods-available (where x.x stands for the php version in use).
I tried all the processes mentioned above and for this and many similar after Googling around, I still ended up with this error
$ php -i | grep php.ini
Failed loading /usr/lib/php/20200930/xdebug.so: /usr/lib/php/20200930/xdebug.so: undefined symbol: zend_get_properties_for
Configuration File (php.ini) Path => /etc/php/7.3/cli
Loaded Configuration File => /etc/php/7.3/cli/php.ini
I resolved this by Updating Xdebug using Pecl. If you do not have it installed following the instruction here
$ pecl install xdebug
Now I changed my xdebug.ini file. You can use
$ locate xdebug.ini
Add zend_extension = usr/lib/php/20180731/xdebug.so to the file.
xdebug.ini
[xdebug]
zend_extension = usr/lib/php/20180731/xdebug.so
The latest version of Xdebug 3.0.4 still uses these usr/lib/php/20180731/xdebug.so but if you try to use $ locate xdebug.so you would see a different file location.
Php output the right Zend Extensions
$ php -v
PHP 7.3.27-9+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2021 15:10:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.27-9+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
For the record, in Linux Mint and I think in some Ubuntu Systems. To change the php.ini it's the best to go to /etc/php/7.0/cli/conf.d and look for the xdebug.ini and you must change the lines said in the post above mine.
I tried below in Linux and worked,
you can use the below command to locate the xdebug.so file path
locate xdebug.so
ex: /usr/lib/php/20160303/xdebug.so
use below command to locate the current php.ini file
php -i | grep php.ini
ex:
Configuration File (php.ini) Path => /etc/php/7.1/cli
Loaded Configuration File => /etc/php/7.1/cli/php.ini
After that add below xdebug configuration to both cli and apache2 folder's php.ini files with correct xdebug.so file path.
vi /etc/php/7.1/cli/php.ini
vi /etc/php/7.1/apache2/php.ini
[xdebug]
zend_extension=/usr/lib/php/20190902/xdebug.so
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_autostart = 1
Finally, restart the apache2 server
sudo service apache2 restart
Make sure that you are using the correct xdebug port in your editor!
Cheers! :)

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