Archive

Posts Tagged ‘phpeclipse’

PHPEclipse + Xdebug + Firefox

October 20, 2010 1 comment

There’s a short but great article about setting up PHPEclipse with Xdebug here: http://bogdan-albei.blogspot.com/2010/06/php-remote-debugging-with-xdebug-and.html

I really don’t want to forget this one!

Inspeccionar funciones en PHPEclipse

Luego de descargar un proyecto PHP desde un repositorio SVN en Eclipse. (Aqui un Howto para descargar Dokeos desde su servidor SVN). Sucede el clásico error de querer inspeccionar includes, funciones, clases en PHP sin éxito. El motivo es que el archivo .project de nuestro proyecto no está asociado con un proyecto PHP según Eclipse.

En otras palabras, se debe modificar el archivo .project agregando el siguiente código:

<buildSpec>
<buildCommand>
<name>net.sourceforge.phpeclipse.parserbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>net.sourceforge.phpeclipse.phpnature</nature>
</natures>

Esto indica a Eclipse que nuestro proyecto es un PHP Project. Voila!

Visto aquí

Instalar Eclipse Ganymede + PHPEclipse + Subclipse + Dokeos dev-1.86 en Ubuntu 8.04

July 24, 2008 12 comments

Luego de tener problemas con la Eclipse 3.2 y de intentar dejar PHPEclipse por Zend Studio, tenía tantas ganas de que PHPEclipse vuelva a funcionar como aquel verano del 2008 donde todo simplemente funcionaba bien. Ahora, con la última versión de Eclipse 3.4 Ganymede hice el proceso de instalación que verán en las siguientes lineas y todo funcionó.

Antes que nada se debe de desinstalar algún rastro es decir del Eclipse 3.2, para ello pueden visitar este post.
Ahora comenzamos con:

1. Instalar Eclipse 3.4 Ganymede
http://download.eclipse.org/eclipse/downloads/

Descargué la siguiente versión: Linux (x86/GTK 2) y lo descargué desde el servidor Columbia muy rápido aqui en Perú. Descomprimir el archivo tar y ejecutar el archivo ./eclipse

Si no tienen el Java Runtime Enviroment es necesario instalarlo:

sudo apt-get install sun-java5-jre

Esto instalará el Eclipse para un usuario solo (instalarlo para todos los usuarios de esta máquina necesita más trabajo y grabar los archivos dentro de un directorio compartido). Un buen lugar para instalarlo para un usuario único es dentro de /home/usuario/src por ejemplo, si es que tienen un directorio para fuentes de programas.

Seleccionar el workspace: por default seleccionar la dirección pública del servidor Apache, en mi caso: /var/www/
(Es necesario que esta carpeta tenga permisos de escritura)

2. Instalar el Plugin – SubEclipse

Seguir los detallados pasos aqui: http://subclipse.tigris.org/install.html
Para esta instalación seleccioné http://subclipse.tigris.org/update_1.4.x

3. Instalar PHPEclipse
El proceso es similar al Plugin SVN pero se debe de agregar el sitio http://update.phpeclipse.net/update/stable/1.2.x/

4. Crear un nuevo proyecto en Eclipse

a. File->New -> Other -> SVN -> Projects from SVN
b. Agregar la dirección de SVN de Dokeos: https://dokeos.svn.sourceforge.net/svnroot/dokeos/trunk
De la lista seleccionar “Dokeos”.
c. Seleccionar “Checkout as a project in the workspace”. y colocar un nombre por ejemplo “dokeossvn”
d. Done!

Comenzará la descarga de Dokeos desde el repositorio SVN.

Si a este punto Eclipse enseña un error acerca del cliente SVN que no se pudo cargar, verifica que todos los elementos del repositorio de Subclipse (es muy probable que necesite JavaHL) sean instalados y vuelve a probar.

Es necesario realizar este pequeño truco para cambiar el proyecto de SVN a PHP y poder hacer inspecciones dentro de funciones, includes, etc. No olviden cambiar la perspectiva a PHP, por default es JAVA.

5. Ver resultados

Luego acceder a localhost/dokeossvn suponiendo que tienen esta dir /var/www/dokeossvn et voila!

Para más información sobre Dokeos y su repositorio SVN : http://www.dokeos.com/wiki/index.php/SVN

30 días con Zend Studio

July 23, 2008 2 comments

Cansado de tener problemas con la combinación de Eclipse v3.2, PHPEclipse y Subclipse v1.1
decidí probar la versión de prueba de 30 días del Zend Studio for Eclipse.

Los problemas básicamente de Eclipse 3.2 eran un conflicto entre el PHPEclipse y el Subclipse.
Para solucionar de una manera poco elegante pero práctica y rápida desintalé el Subeclipse y comencé a mandar los commits de Dokeos por consola (trabajo sobre una Ubuntu 8.04)

Pero los problemas no iba a parar, al crear un nuevo proyecto en Eclipse, apareció un error inexplicable y nunca más cargo. Es por eso que opté por probar el Zend Studio.

Aqui mis comentarios:

Lo malo

  1. La función Ctrl-Click para inspeccionar funciones, constantes, includes, etc no funciona.
  2. No existe una lista de las funciones declaradas en un archivo PHP. Hablo sobre la vista “Outline”.
  3. Al igual que en PHPEclipse no existe la selección vertical. Algo MUY importante que se debería incluir en este tipo de IDEs. Por ejemplo, las versiones de Delphi y de Notepad++ lo tienen.
  4. En la vista “PHPExplorer” (donde se muestra la lista de archivos) se observa el número de Commit pero no la fecha ni el usuario que hizo el commit.
  5. 304 Mb la descarga!
  6. ¿Olvide decir que cuesta $399 dólares?
    Según el sitio web: $399 for 1 year subscription to support / $717 for 3 years subscription to support

Lo bueno

  1. PHP Functions: Biblioteca de funciones de PHP, ahorra tiempo en lugar de visitar http://www.php.net
  2. El SVN SI funciona.
  3. Ningun crash hasta el momento.
  4. Fácil de instalar unos “10 clicks”. No hubo necesidad de instalar otros plugins.
  5. Lee muy bien los .js. En PHPEclipse es necesario instalar otro plugin.
  6. Incluye la funcionalidad “Create NEW SQL connection” un wizard para crear cadenas de conexión, aunque no lo utilicé porque en Dokeos ya existe una clase “Database”.
  7. Y muchos pequeñas cosas que podrían facilitar el desarrollo desde cero (from scratch) aunque en mi caso no fueron usadas debido a que Dokeos ya tiene incluidas clases para manejar la BD, la Seguridad, las Sessiones, etc, etc.

La versión utilizada fue:
Zend Studio for Eclipse Professional Edition Build ID: 20080601

Conclusiones

El Zend Studio es un buen producto, tiene algunas funcionalidades que harán más rápido el proceso de desarrollo, sin embargo, por $399 uno espero algo mucho mejor. Si tan solo el PHPEclipse. Pronto una reseña de Eclipse Ganymede la última versión de Eclipse.

Actualización: Pueden ver este post para poder instalar Eclipse 3.4 Ganymede + PHPEclipse + Subeclipse

HOWTO Install PHP-Eclipse for Eclipse 3.1 on Debian Sarge

October 28, 2005 8 comments
This article was first written in October 2005 for the BeezNest technical
website (http://glasnost.beeznest.org/articles/296).

Introduction

This article helps installing Eclipse 3.1 and the PHPEclipse plugin on a Debian Sarge install. This means installing the basic software, installing the PHP plugin into it, creating a new project and testing the debug functions.

Eclipse 3.1

There is no (official) package for Eclipse 3.1 on Debian Sarge (Sid has version 2.1?), so this install procedure is based on the binary software available for Linux x86 here.

Download the software and uncompress it (it uncompresses in a directory named eclipse, so you can uncompress it wherever you want to) and move into the eclipse directory.

$ tar zxvc eclipse-SDK-3.1.1-linux-gtk.tar.gz
$ cd eclipse

Quick start Eclipse by launching the eclipse executable

$ ./eclipse

Decide which directory will be your workspace. The workspace directory is where Eclipse files are kept, not where your source files are kept, so don’t use the sources directory as this will conflict with projects you might create later.

Select “Workbench” (unless you want to learn more about anything) in the intro screen.

You are now inside the IDE.

PHP Plugin

To get an open-source free sofware PHP plugin, go to the SourceForge page for the plugin and download the plugin for Eclipse 3.1 stream (not official by the time of writing).

Once downloaded, unzip the file in the newly-created eclipse directory, they should be written into the plugins and features directory directly.

$ unzip phpeclipse-1.1.6-unofficial.zip

Now start Eclipse again

$ ./eclipse

Inside Eclipse,

  • use File > Import > External Features
  • select the location (normally the Eclipse directory) and click Next
  • click “Select All”
  • click “Finish”

Then import plugins in the same way

  • use File > Import > External Plug-ins and Fragments
  • Click “Next”
  • Click “Add All” (or only select the ones coming from sourceforge if you want to restrict to the minimum)
  • Click “Finish”

Create a PHP Project

  • use File > New > Project…
  • Click “PHP”
  • select “PHP Project” and click “Next”
  • give a project name
  • uncheck the box (if your source code directory already exists) and enter the path to your sources for this project
  • click “Finish”

You now have a new project appearing in your left navigation bar.

Setting up PHP interpreter

For some reason, the plugin expects to find the PHP interpreter as /apache/php/php. You don’t want that as on a Debian machine, it is located at /usr/bin/php (or php4). To change it, use the Run > Debug menu

  • Click on “PHP Application”
  • Click “New”
  • Give a name (“My interpreter”?)
  • Select the file you want to debug in this case (just select one PHP file from your new project)
  • Select the “Environment” tab
  • Select the “Interpreter” tab
  • Browse to select /usr/bin/php4
  • Click “Debug”

That’s it, you have debugged your first PHP script with Eclipse.

I am still starting there, so I don’t understand why the interpreter tells me I have an unexpected ‘$’ at the end of my script, but I might find that later, and so might you.

Fixing up PHP projects building when it disappears

After a while (I’m using Eclipse 3.2 now), you might run into a problem with the PHP building process, whereby using the CTRL+Click on a function name will tell you The resource is not on the build path of a PHP project. If thi is the case, you’ll want to fix a few things to make it work. First, edit the .project file in your projects root, and make sure the <buildCommand> and <nature> tags below exist (otherwise add them and their contents, as is):

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>myProjectName</name>
  <comment></comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
      <name>net.sourceforge.phpeclipse.parserbuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>net.sourceforge.phpeclipse.phpnature</nature>
  </natures>
</projectDescription>

This is taken from a technical forum.

Then, you need to (probably restart Eclipse and) right click on your project and select Properties then reset the Document Root in PHP Project Settings (after selecting Use project settings).

When asked if you want to rebuild, click Rebuild now/Yes. That should do the trick.