Much has been written about debugging PHP in eclipse, yet for all the blogs and tutorials I have had no end of problems. My setup was complicated by the fact that I was trying to debug command-line scripts using the symfony framework. Only the last part was really symfony-dependent, however. Here is what finally worked for me.
Either for Zend or Symfony, to use it in eclipse PDT, you need first to download it from the official web site ( zend's latest download page, Symfony's download page ). Then, add the library to eclipse (Window - Preferences - PHP - PHP Libraries and then new, navigate to the downloaded directory). Finally, after creating the project, right-click on it, Include Path - Configure Include Path - Add Library - Choose User Library then next and select the needed libraries. Vamos a configurar las cosas que nos hacen falta para trabajar con symfony en eclipse. Instalaremos: PDT, Symfony, Yedit y C.
Eclipse Symfony 4
- Windows XP
- PHP 5.2.6
- Eclipse 3.3
- Symfony 1.0.11
Introduction There are a number of times I've had to use HTTP cookies for some of the Symfony projects I've developed at Taft College. There is some documentation on using cookies, but you really need to look at either the API documentation or search online for various references to get good examples on how to. Klan serial 2020. Symfony eclipse plugin. Contribute to pulse00/Symfony-2-Eclipse-Plugin development by creating an account on GitHub. Enabling Symfony After installing the Symfony plugin, you will need to make your project Symfony aware. To add Symfony to your project: In the PHP Explorer, right-click your project and select Configure Add Symfony Support.
Debugger Choice: Zend
First I needed to decide on a debugger. In the end I found that Xdebug caused nasty PHP crashes at the end of some runs. I’m not sure why I had this problem, but I wound up using Zend.
Eclipse, servers, and clients
Eclipse 3.3 comes with debug clients for Xdebug and Zend debugger built-in. If you look in Window -> Preferences, PHP -> Debug -> Installed Debuggers, you should see them there. This does not mean, however, that you have everything you need ready to go.
PHP must also be configured (in php.ini) with debugging support. This involves loading an extension for Zend debugger or Xdebug. Eclipse comes with a version PHP configured with Zend debugger. On my system it was here:
The key to this is that in that same directory is a php.ini that loads ZendDebugger.dll (also in the same directory).
Eclipse Symfony Project
Furthermore, Eclipse seems to require that your PHP have debugging support built in, even when you Run (not Debug).
The Zend debugger slows down PHP significantly. I didn’t want to have it enabled by default. So, I created a separate ini file that includes the Zend debugger and told Eclipse to use it.
My code used MySQL, so I needed at least that extension loaded in PHP.
- Install everything (Apache, PHP, Eclipse, Symfony, etc.)
- Find ZendDebugger.dll in your eclipse plugins dir (see path above for a hint)
- Copy it to your PHP extensions dir (a subdir of your main PHP dir)
- Create a copy of php.ini called php-debug.ini
- In php-debug.ini add the following (substituting in the proper path to PHP):
- In Eclipse, go to Window -> Preferences, PHP -> PHP Executables
- Click Add
- Specify a name that you will recognize
- In Executable path, find your standard php.exe (not part of Eclipse)
- In config path, specify php-debug.ini
- Choose Zend Debugger
- Now, to run or debug you will need to choose the PHP Executable that you created.
To make it work with symfony, create the following file, named bootstrap.php, in your project root dir:
// From symfony.bat
// ‘Calls’ the php script symfony
Then, to run a symfony command, for example symfony test-unit Foo, you would do the following:
- Go to Run -> Open Run Dialog (or Open Debug Dialog)
- Make sure PHP Debugger and PHP Executable are set correctly.
- Specify bootstrap.php as the php file to run
- In the php script arguments, put the symfony parameters (e.g. test-unit Foo)
For regular symfony commands you would still do it straight from the command-line, or using Symfoclipse. This is useful for unit tests and the like where it would invoke your code.
Sometimes, PHP executables that are created are not made available in the Run or Debug dialogs. I don’t know why, but creating new PHP executables (without removing the old ones first) seems to work around the problem.
Eclipse Symfony 4 Plugin
Tags: Eclipse, PDT, PHP, Symfony