Eclipse Symfony

I have created a 4.4 project using symfony new 4.4-upgrade -version=4.4. I want to use several bundles that I use in other projects so I expect my directory structure to look like. Symfony eclipse plugin. Contribute to pulse00/Symfony-2-Eclipse-Plugin development by creating an account on GitHub. To create a new Symfony project: Go to File New Other. The New Project Wizard's Select a wizard dialog is displayed. Type Symfony in the Wizards field, select Symfony Project and click Next. The New Symfony project dialog is displayed. Set the following parameters: Project.

  1. You have to make sure youre vendors are installed correctly and also make sure you have a php executable running. In eclipse menu: window - preferences - Php - php executables. If you have nothing there: Click add - browse the executable (normaly /usr/bin/php5). Use zend debugger and check the 'use defaults php.ini' box.
  2. Symfony Eclipse. Symfony is a popular PHP Web Development framework and a set of standalone components available as PHP libraries. This eclipse plugin aims to provide support for framework specific idioms. It is built on top of the Dynamic Languages Toolkit and the PHP Development Tools and adds some useful features.

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.

My setup:

  • Windows XP
  • PHP 5.2.6
  • Eclipse 3.3
  • Symfony 1.0.11

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:

C:Program Fileseclipsepluginsorg.zend.php.debug.debugger.win32.x86_5.2.10.v20070905resourcesphp5php.exe

The key to this is that in that same directory is a php.ini that loads ZendDebugger.dll (also in the same directory).

Furthermore, Eclipse seems to require that your PHP have debugging support built in, even when you Run (not Debug).

Eclipse symfony cannot be resolved

Other considerations

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.

The Steps

  1. Install everything (Apache, PHP, Eclipse, Symfony, etc.)
  2. Find ZendDebugger.dll in your eclipse plugins dir (see path above for a hint)
  3. Copy it to your PHP extensions dir (a subdir of your main PHP dir)
  4. Create a copy of php.ini called php-debug.ini
  5. In php-debug.ini add the following (substituting in the proper path to PHP):
  6. zend_extension_ts=”C:/Program Files/PHP/ext/ZendDebugger.dll”

  7. In Eclipse, go to Window -> Preferences, PHP -> PHP Executables
  8. Click Add
  9. Specify a name that you will recognize
  10. In Executable path, find your standard php.exe (not part of Eclipse)
  11. In config path, specify php-debug.ini
  12. Choose Zend Debugger
  13. Add
  14. Now, to run or debug you will need to choose the PHP Executable that you created.

Symfony

To make it work with symfony, create the following file, named bootstrap.php, in your project root dir:

<?php
// From symfony.bat
ini_set(‘html_errors’, ‘0’);
ini_set(‘open_basedir’, ”);
// ‘Calls’ the php script symfony
require(‘./symfony’);
?>

Eclipse symphony neutral

Then, to run a symfony command, for example symfony test-unit Foo, you would do the following:

  1. Go to Run -> Open Run Dialog (or Open Debug Dialog)
  2. Make sure PHP Debugger and PHP Executable are set correctly.
  3. Specify bootstrap.php as the php file to run
  4. 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.

Eclipse Pdt Symfony 4

Problems

Eclipse Symfony 4

Eclipse Symfony

Eclipse Symfony Project

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.

Tags: Eclipse, PDT, PHP, Symfony