Using aptana to debug with easyphp +cakephp - php

I'm starting a new project, for this project, I need a great IDE, which allows me to debug. I thought to aptana after some search.
But this project is a little specific, it has to work with a specific version of php and has not common extension(e.g. php_ingres), so I think I cannot use the internal server of aptana, otherwise it will not find every ingres function.
I've an EasyPhp environnement installed and working.
I've created a new "Simple server" and a new web browser configuration using this webserver(and chrome). But now when I try to debug it, I cannot see my browser configuration, it looks like it display only internal servers here. So is this possible to use aptana with easyphp? If yes, how?
If not, which IDE provide some auto-completion, debugging and allows me to use my own server?
Thank you very much

I think Netbeans can do your job, check this guide :
http://wiki.netbeans.org/HowToConfigureXDebug

Netbeans is great and is free too. But it maybe hard to figure your way around in that for a 1st time user. If money ain't a problem i'd suggest using phpDesigner 7 - http://www.mpsoftware.dk/phpdesigner.php. Easy and simple, with word completion, debugging features and also allows you to setup up an FTP connection to your servers so you can edit your files on the fly.(This method of editing files on the fly however may not be ideal if its mission critical data. I'd suggest using version control platforms like git, read more here - http://progit.org/book/ch1-1.html )

I finally used code lobster, which is not the best editor but can use easyPhp and actually debug into it.

Related

Testing Tools for PHP

any good open source/commercial PHP testing tools available??
I don't know exactly what do you want to test but here are some tools which help during development:
PHPUnit for unit tests
CodeSniffer for coding standards
PHP Mess Detector for code quality
For testing a web application within your web browser automatically try Selenium.
I can also recommend FirePHP with will enable you to debug your code using the Firebug plugin for Firefox.
A list of PHP Performance Test Tools in this link http://scriptime.blogspot.in/2014/07/performance-test-tools.html
Check out PHPUnit:
http://www.phpunit.de/
One especially handy tool to debug is xdebug. Install through PECL. Integrated with your IDE you'll be able to interactively step through code. Without the IDE and it'll prettify your errors and help you test them.
For automatically testing the app itself, Selenium seems to be the best choice. Note that I don't use it, but it will automatically simulate going to a page, filling in data on a form, etc. It's basically a way to automate users' activity in a browser.
The other suggestions are all apt as well.
To test the code you should write unit tests. This requires two tools, what you need is a debugger (xdebug or zend debugger) and phpunit. They can be written in any editor. If you haven't done this before here is an intro article.
http://devzone.zend.com/article/2772
To test the output of the code (HTML,CSS,JS) you should use a different tool. A GUI testing tool is what you use for this job. Here is a list of these tools. Selenium and Selenium based tools is probably the way to go, but the best decision depends on the company and lack thereof.
http://en.wikipedia.org/wiki/List_of_GUI_testing_tools
Do you mean a site where you can run PHP code in order to test it? Like localhost?
OK, I'll give you an answer without the smarm :-).
Here, get started with XAMPP http://www.apachefriends.org/en/xampp-windows.html. I don't know of any in-browser PHP testing methods, and I can (off the top of my head) think of several ways that a good coder might exploit a site that uses eval() to run user-submitted code. They'd basically be giving anybody free range to run code on their server. But look...get started on XAMPP and there you can start testing PHP scripts without even needing an internet connection. Also if you're interested in a good PHP beginner's guide, see here:
http://www.tuxradar.com/practicalphp
Not sure if this is for debugging or for testing but i found WAMP to be a good alternative to XAMP. Thats what i use for testing

How to do Debugging of PHP?

how we do basic debugging in PHP ?
Can anybody share true horror story on debugging PHP application (or (even better) on PHP framework such Codeigniter and Wordpress) ?
i love to hear real experience in case i have to encounter similar situation on my journey to learn PHP.
XDebug may be used to debug a PHP application. Basically you install this on your server and configure it in PHP.ini. Then on your desktop machine, you can setup Netbeans (and maybe Eclipse, but I have not tried that) to remote debug. When you are in a remote debug session you can do any of the things you typically expect: set breakpoints, step through code, etc.
One major annoyance when using CodeIgniter with mod_rewrite is that the debugger gets confused by index.php not showing up in the URL. I am not sure if this is a problem on the client side or server, and whether CI "eating" the GET portion of a URL has anything to do with it. In any case, I have worked through it by copying a 'debug.php' file to the server and starting debugging with that file - everything seems to work fine after that.
I any case, I highly recommend you get setup with XDebug at some point. You may not use it everyday, but when you need it you'll be thankful you did your homework ahead of time.
Easiest option (without installing any IDE) is to use firefox FirePHP addon.
Download and install FirePHP firefox addon
Download FirePHP core library from their website
Extract FirePHP library you downloaded in step 2 and only copy FirePHP.class.php to CodeIgniter /application/libraries/ folder, but give it a name FirePHP.php without the class part
Turn PHP’s output buffering on
Start your Firefox, click the FireBug icon on the bottom lower area, or go to menu and select tools. After you turn on (set them to enable) FireBug and FirePHP, be sure to click on the Net tab next in line to HTML, CSS, Script, DOM and set it also to enable.
See this link for how to use firephp library: http://speedtech.it/2009/05/debugging-a-codeigniter-application-with-firephp/
There is one problem in using IDE debugers - it's bad for debuging AJAX applications. In this case you will need to use some of browser extension. For FireFox it's FirePHP, and gor Google Chrome it's Php console.
I checked out a lot of debuggers 2 years ago when I wanted to set up a debugging environment for myself in PHP. I posted a brief post on this, you can go through it http://forums.codewalkers.com/general-chat-93/which-php-ide-to-use-840352.html
Bottomline was that Nusphere's phped was the best and its debugbreak() function makes debugging a real bliss. With codeigniter also this works fine, no tweaks required if you have already enabled get variable. The only hiccup with codeigniter+phed is that, you cannot do code navigation like "right click and find declaration" for other files models.
Off late I have been checking out codelobster they have a codeigniter plugin, but I am not through with it yet.

A way to work on web projects with others without over writing files.. etc

I am a web freelancer and had been doing all coding by myself using netbeans (set up to use a remote server (ftp)).
Recently, I started working with 2 other guys. They help me with php and css. The problem is that sometimes we want to work at the same time. Obviously one can immediately see the problems were having. Files being over writting / lost.
What do you recommend we do? Is there something like netbeans that allows checking in and out of files. I like netbeans as my editor and would prefer to keep it.
To give you a little extra information on our workflow. Usually I set up a dev site (generally a subdomain, dev.site.com) and a live site (site.com). All work is done on the dev site which I then move to live site once all is finished. I never use localhost sites.
Also
Surely you need a version control system. Subversion and Mercurial (amongst others) integrate fairly well with Netbeans.
Simply use some versioning system to prevent data loss.
Git
CVS
SVN
Other option is to use some file locking system.
Take a look at some source code management tools. Netbeans supports at least SVN and CVS. They should be listed under the Team menu. It has a FAQ on which it supports
Sounds like a job for Github
Assembla provides a free SVN hosting for collaborative projects.

REMOTELY Debugging PHP Using Eclipse

I'm a self-taught noobie, trying to debug PHP on my GoDaddy hosted server. Is this idea even rational, or do I need to continue to do all development locally and just continuously re-ftp upload the changes?
Is there some way that I can use eclipse to step through, and debug my php scripts that are hosted on a third party site?
Although I have only used Netbeans and XDebug for remote debugging, it should be possible to use Eclipse PDT and XDebug. See:
setting-eclipse-pdt-and-xdebug
Debugging PHP applications with xdebug
One caveat, however. To configure xdebug you will need to modify some settings in php.ini - I am not sure if this will be possible on a hosted server. If not, you would need to have a local server that you use for debugging, and would need to figure out another solution for your "production" environment. Which may not be a bad idea, actually, as it would give you a good place to test your changes without risking breaking anything on your actual site.
Also, I recommend that you look into Netbeans, if for no other reason than to experiment and see what it can do compared to Eclipse. One nice feature is that you can set it up to automatically ftp (or scp) changed files to the remote site. So you can make some code changes, click the debug button, and after waiting a moment for your files to upload you can be stepping through code on the remote site.
While there is definitely a case for remote debugging you should always be working locally and then uploading. Anything except the most minor of changes should be done locally tested then pushed to a server - sometimes production directly, sometimes a testing server...
Yes Eclipse supports remote debugging with Xdebug as well as the one from Zend Debugger check out Justin's links as well as This one for Zend Debugger. I think Zend has an all in one with pdt+deps and Zend Debugger - ofcourse you still need to set up the extension on the server (note link is for setup on windows but hte process should be similar).
Obligatory "Ewww GoDaddy" :-)
If the web server have XDebug installed, then you can do debugging with it. Searching for it in google yield a quite num of articles on how to do it.
Personally, I'm using CodeIgniter. I do debugging using FirePHP and PQP. Make a habit to write a good indented code. You might find your code have less bug, both syntax and logic, and easier to maintained in the future. Use a consistent white space, either tab or space. Use a consistent bracket style. It will save you from the headache when re-read it for bug or adding more feature later.
I have never needed to do a step by step debug in PHP, but when I do need to debug I just output strings of the variables at that point.
However, one thing that I found, but again never used, was FirePHP:
http://www.firephp.org/
As far as I'm aware, this is not possible in Eclipse, it is, however, possible in NetBeans, but as Nathan stated, I've never really needed to remote debug any of my PHP scripts.

PHP Console that doesn't require heavy installation or a desktop app?

I'm looking for clean way to break my current habit of using print commands in PHP when I want to see what's happening.
I am aware of options such as Zend Debugger but I use Coda for development and I'm not interested in mixing other software or having to do server commands. I just need a console that can be added to my codebase and then turned on/off.
Does anything like this exist? Furthermore, what do you use and why?
EDIT: There was a lot of stuff out there but I needed something even simpler so I ended up coding it myself. It didn't take long (nor is it very pretty) but I've put it up on my server for anyone else interested.
There is very good extension for Google Chrome - PHP Console.
You can use Xdebug in combination with any one of the many options available to view its debugging info.
There's FirePHP which will write your PHP log messages to the Firebug console.
I am aware of options such as Zend Debugger but I use Coda for development and I'm not interested in mixing other software or having to do server commands. I just need a console that can be added to my codebase and then turned on/off.
Not entirely sure if I understand you there, but couldn't you log to a file and then have a console window running with tail -f /path/to/log-file.txt? That works pretty well for me. Of course, you do need a console connection to the server for this.
Using Coda? That means you are using a mac. You probably want to look at XDebug and http://www.bluestatic.org/software/macgdbp/
There is another extension for Chrome available called ChromePHP. It's a little simpler than some of the other solutions:
https://chrome.google.com/webstore/detail/noaneddfkdjfnfdakjjmocngnfkfehhd
Getting started guide available at:
http://www.chromephp.com
During my development career i have not stumbled upon a software that displays the output you describe in your question. It would be a wonderful program or feature i believe but sadly i have not found any.
Like Andrew and nickf have answered, there are some good tools out there and until someone sits down and writes this, it looks like we are out in the cold.
I was looking for similar solution which wasn't heavy and even better I didn't need to include any classes, so I created simple function that outputs php to browser console, you can check it here:
Outputting PHP To Browser Console

Categories