How to debug prestashop using Aptana? - php

I just downloaded and installed Prestashop, which is a PHP e-commerce system.
I also downloaded and installed XAMPP and Aptana , an open source IDE for PHP development. It uses MVC of some sort. (Sorry, I am completely new to PHP).
It looks ok, I can access the site and the changes I perform in Aptana are reflected in my localhost website.
Now I would like to debug the execution, Aptana has an built-in debugger and it works for a test example I downloaded from the internet (here). It works.
But when I try to set the breakpoint in the Prestashop project, it does not suspend the execution. Also, when I click on a link, the debugger stops.
I really have no idea how to set it up. Do you have any experience in debugging PHP? How can I set it up? I would be fine to change the IDE, if it helped me debugging this system.
Thanks,
Oscar

Prestashop has some good debug code built in already.
In config/config.inc.php change the define for _PS_DEBUG_SQL_ to true (you can also turn error reporting on in here) and in config/defines.inc.php set the define for _PS_MODE_DEV_ to true also.

Use Netbeans to debug your prestashop. In Netbeans you can use Unit Test or etc. check Netbeans tutorial for detail

Related

vscode php development setup php intelephense and phpcs

I want to setup my development environment using vscode. However, I am confused on that would be the difference between intelephense and phpcs. I have the code in Github from my company and it has the .phpcs.xml.dist. I believe this file is for phpcs. It works already but I missed the intelephense code formatting and autocomplete feature. Can someone help in elaborate more on the difference between these 2 and do they conflicting each other should I installed both of them in my vscode.
TIA
Hery
Intelephens have lots of feature, but most people use it for auto format code file.
Intelephens uses PSR12 as default standard Sortcut Key [Shit + Alt+ F] it also format HTML, Css, Js. It detect PHP version from your Host envirment and show you code warnings and systex error.
If your Dev team use PHPCS then you may need to use PHPCS vscode extension.
Not sure about Intelephens can detect .phpcs.xml.dist from your project. Your team may have CICD Pipline to check code stadarad (via phpcs) and fix them (via phpcsf)
or reject PR via Bot!
Both are the best way to reduce None standard code.
if you are using opensource then use styleci it's free for public repository.

JIT debugging PHP in Aptana Studio

Linux Mint 15, Aptana Studio 3.4.1, Chromium 28.0.1500.71
Sorry, this is a little lengthy to explain. Please let me know if something's not clear.
The title is my goal. I have a local server set up with Apache2. I don't know if it matters, but I have dnsmasq set up to redirect, for example, site.dev/index.html to /home/wastvedt/Projects/site/www/index.html (described here).
I've followed the tutorials I can find. XDebug is running, I have the helper installed in Chromium, and the debugger, interpreter, and web server set up in Aptana.
I'm working on a WordPress site and want to break on one of the functions in my theme's functions.php file. I created a breakpoint in the function in Aptana, turned on the XDebug helper in Chromium, and updated a post, which calls the function in question. Aptana recognizes what I'm doing and prompts me with the option of breaking on the first line. Regardless of what I select, I see "XDebug JIT Session [Remote Launch]" in the Debug view. The prompt appears three times, but nothing else happens in Aptana.
I think the problem might have something to do with linking files in the editor to files in Apache. When I try this JIT debugging thing with "localhost" (located at /home/wastvedt/apache2/www/index.php), Aptana brings up /home/wastvedt/Projects/site/www/index.php. This isn't right, but maybe the real problem is somewhere else. To be honest I'm a little lost now.
Any thoughts? I'd provide some sort of dump or output, but I'm not sure which or what.
Thanks for reading,
Trygve
In order to properly setup XDebug with Aptana I setup the below options by going to the Window menu -> Preferences -> Aptana Studio -> Editors -> PHP -> Debug:
Allow multiple debug sessions: Always
Break on first line when an unknown remote sessions (JIT): Never
Then click on XDebug in Installed Debuggers -> Configure:
Use Multisession: OFF
Accept remote session (JIT): any
That pretty much made it work for me.

Just downloaded MacGDBp, unsure how to use it

I just downloaded latest MacGDBp 1.5 but I am unsure how to debug my php scripts through it. There is no documentation or readme on the website as well.
Looking for how will I load my Php scripts to debug in it?
Does it always works in conjunction with other IDE like Eclipse?
Currently it only debugs what ever I am debugging with Eclipse.
Thank you

XDebugging PHPUnit testcases in Eclipse PDT

Until now, I was debugging my PHP scripts and testcases using vim and the appropiate script with python backing it. However, me and my colleagues need to move forward and vim/gvim is not an option for them.
So I've tried to integrate debugging PHPUnit in Eclipse on my setup as an external tool, which again, works with vim. However, it simply waits for something when I
Launch the new external tool, then
start debugging as a CLI script
Remote debugging is enabled, the environment variable XDEBUG_CONFIG="idekey=ECLIPSE_DBGP_127.0.0.1" is also set.
Any ideas?
Addendum
Running the testsuite works. Debugging a web page works. Debugging a given test doesn't.
Eclipse waits forever for something at 57% when trying to debug a phpunit test. I'd like to provide more information, but it doesn't tell me more either.
I have wrote an article about how to get it done launching phpunit unit tests from eclise pdt not using the external tools launcher but the phpunit.php script itself, look here:
http://elespaciodejaime.wordpress.com/2010/04/19/pruebas-unitarias-en-joomla-con-phpunit-y-soporte-para-debugging/
the explanation is at the end, by the way, it is in spanish.
You find a tutorial and the code of a simple lightweight way of testing Joomla 1.5 and Joomla 3.x component here on Github. You can see what changed between testing under Joomla 1.5 and in Joomla 3.x. The examples are based on the use of PHPUnit + DBUnit installed with Composer and configured and run in Eclipse Luna for PHP Developer (PDT).
you can launch a debug session by going to the php debug perspective and select from the menu run->debug->debug as php web page or debug php script.
If you use zend studio you can debug as a php unit test.
There is also a firefox extension that helps with debugging with xdebug https://addons.mozilla.org/en-US/firefox/addon/3960
Also make sure go to preferences panel and select php->debug->installed debuggers and click on xdebug then click on configure. There should be an option to allow incoming connections. Select that and you can launch remote debug sessions from firefox.

NetBeans PHP and XDebug - jumping to methods on call stack?

I'm having trouble with debugging a PHP project through NetBeans using XDebug, and was hoping someone out there might have had this problem before.
Debugging works fine for the requested php file - so if I go to index.php on the remote server, I can put a breakpoint anywhere in index.php in NetBeans and the code stops there and I can step through.
The trouble is, all the other files appear on the call stack like this: "file:///home/user/site_html/library/class.requestprocessor.php" and because that's a path to a file on the remote server, NetBeans is unable to resolve the name, and so I can't step through the code for it. It makes debugging practically useless! The php file that was requested, for example index.php, appears just as "index.php", it's just all the other ones which are included that NetBeans can't resolve properly.
Is there some setting in NetBeans or XDebug that I can use to solve this problem? I have tried my best looking through all the project settings and options in NetBeans, and also looked through all the configuration options of the XDebug extention, but to no avail. Surely someone out there must have had this problem before? How did you solve it? I'll be very grateful if you could let me know.
If there's no other way, do users of Eclipse PDT and XDebug have this problem when debugging on a remote server? If not I'll make the switch.
This issue appears to be fixed in NetBeans 6.7.
Okay it seems no one is going to answer the question, so I'll post the results of my research.
As I was unable to find a way to make NetBeans successfully debug as I wanted, I tried using Eclipse PDT and Visual Studio 2008 with the VS.php extension in order to solve my problem. Eclipse PDT was hell to setup, and I wasn't happy with the way you couldn't specify a port to use for your FTP server in its Remote Server Explorer. I found VS.php did everything I wanted, it automatically uploads the code, as well as having perfect debugging, and it was EASY to setup. The only thing is, it looks ugly and I can't find a way to customise its colours. However, I'm going to choose function over fashion, and so I've settled on using VS.php as my final solution. Which to be honest is a shame, NetBeans was really great, I just can't live without a working debugger.
I had this same issue. I'm running Netbeans 6.8. You have to right click on your project, go to project properties/run configuration/advanced and set up path mapping. Map the folder on the server to a folder locally so that Netbeans knows which files to open locally when it hits these methods.

Categories