Écrire une réponse

Veuillez écrire votre message et l'envoyer

Cliquez dans la zone sombre de l'image pour envoyer votre message.

Retour

Résumé de la discussion (messages les plus récents en premier)

mathiasm
2010-02-16 23:48:50

plg a écrit:

grbaues a écrit:

J'ai voulu le poster sur le site anglais mais il semble que mon compte a disparu :-)

On a subi une attaque à la création de comptes par des robots et on a peut-être eu la main "un peu lourde" en nettoyant la base. On s'occupe de restaurer ton compte.

utilisateur restauré, j'ai même mis un coup de polish :-).

plg
2010-02-16 22:49:04

grbaues a écrit:

J'ai voulu le poster sur le site anglais mais il semble que mon compte a disparu :-)

On a subi une attaque à la création de comptes par des robots et on a peut-être eu la main "un peu lourde" en nettoyant la base. On s'occupe de restaurer ton compte.

grbaues
2010-02-16 22:44:35

Hello

ce que suit est un "How-to" pour construire un environnement de dev pour PHP sous eclipse. Il est en anglais. J'ai voulu le poster sur le site anglais mais il semble que mon compte a disparu :-)

C'est pas encore totalement fini  (je n'ai pas encore ecrit comment faire pour piwigo lui même il y a que la base mais qui devras permettre a tout personne intéressée de commencer ). Ev les admin pourront faire un cross-post sur les autres forums  de piwigo

Have fun!
Cheers gr

Interested in Piwigo but missing some stuff ( well not really ) I wanted to see if I could do some development and was looking for a decent development environment including a decent debugging tool. Coming more from the Java side looking to Eclipse was more or less a nobrainer.
Here is with what i came up with. The following is for Windows but i will ev update it for Linux as well.

What you need :

Eclipse PDT get it from here :  http://www.eclipse.org/pdt/

Xampp : This contains all the rest of the env in one convenient package ( Apache, php, debugger and mysql lots of other goodies ) Get it from here ( for this tutorial get the Windows Version in zip format ) :  http://www.apachefriends.org/fr/xampp.html

Xampp contains : Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System pour Win32 et NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, et WEB-DAV + mod_auth_mysql. But also  XDebug for debugging PHP.  Plenty enough for having some fun. ( For more info on XDebug see here : http://xdebug.org/ ; No need to download it though! ) 
That's it nothing more :  Eclipse PDT + Xampp

Now for installation:

What i like here with both tools is that i don't have to do a great deal of installation into obscure places or even configuration . Installation comes as easy as unzipping what you downloaded !
Now off we go:

XAMPP

First install xampp ( i used the zip downlaod ) i.e. unzip it into some convenient  location e.g. I put it into : 
C:\software\xampp
Done. Nothing more required. Let's test if it works as expected:
1) Run xampp_control which allows you to start Apache and mysql by the press of a button from here: C:\software\xampp\ xampp-control and start at least Apache. ( Press the start button ).
2) Test the installation by going to http://localost  in any browser and you should have a nice xampp welcome page. Check out your php install by clicking on phpinfo() on the lefthand side.

ECLIPSE

Now install eclipse i.e. unzip into some convenient location. I did this as for xampp on
C:\software\eclipse
Finished; Installation has been done!! Run eclipse at C:\software\eclipse\eclipse and it should fire up.
That was too easy yes you are right we still have some configuration in both tools to do before our setup is complete  in order to work properly in particular with the Debugger! And yes we have to install piwigo too :-)

Configuration :

Xampp :

In order to get the debugger going we have to edit the php.ini file located at:
C:/Software/xampp/php/php.ini
uncomment the following line :
# zend_extension = "C:\Software\xampp\php\ext\php_xdebug.dll"
This enables XDebug for your php environment. You can check this by going to http://localhost and check phpinfo(). (Make sure that Apache is running in the xampp control panel).  Just before the PHP Credits section on the lefthand side of the Zend logo it should say now "with Xdebug ...."

Eclipse :

Now we have to configure eclipse a little bit :
So start eclipse and go to "Window" -> "Preferences" and select the little triangle on the left of  "PHP" on the left side of the window. This will give you a set of options for the PHP environment.

1) click on the little triangle on the left of "Debug"  and select "Installed Debuggers" This should give you two items "Zend Debugger" and "XDebug". This is just to verify that XDebug is properly recognized. Nothing to do here.

2)  click on "PHP Executables" and select "Add". In the popup provide a name a e.g. "PHP 5.3.1" and set the paths for the executable and the ini file. In my case :
"Executable path" : C:\Software\xampp\php\php.exe
"PHP ini file:" C:\Software\xampp\php\php.ini
as a last step set the PHP debugger to "XDebug" and click "OK"

3)  go back to the "Debug"  option BUT this time click on "Debug" and not on the triangle as in step 1)
This will give you some fields to fill under "Default Settings":
PHP Debugger : select "XDebug"
Server : "Default PHP Web Server"
PHP executable : In the drop down list select the entry with the name you gave your executable in step 2)

Thats it now we are ready to do some testing and make a first small script for verification before we look into installing piwigo into this environment:
You guessed it this needs some more configuration in this case on Apache as the webserver will have to find the files which are in the workspace of your eclipse project but first lets set up a small PHP project in Eclipse.  Remember eclipse asks for the workspace to start in when launching? 

For the purpose of illustration I assume the workspace being C:/workspace but this can be anywhere you like it but remember Apache will have to find that path. We come back to this later when configuring Apache.

So you launched eclipse with C:/workspace as your workspace for this session. Next we create a new project : "File" -> "New" -> "New PHP project". In the new project window give it a name e.g. "debugTest" and click "Finish". The project will show up on the left hand side in the PHP Explorer. Do a right click on the project name and select "New" -> "PHP file". Give it a name "hellopiwigo.php"  and click "Finish". This adds the file to the project and put you in the middle plane in edit mode on that file. Add the following 
<?php
$name = "piwigo";
for ($i = 0; $i <= 100 ; $i++) {
    print("Hello, $name ($i)! \n");
}
?>
Save the file (Ctrl-S) will do the job. Nothing fancy here but it will do the job for you playing around with the debugger afterwards.
Now we have our PHP project. Can we just run it ? Of course you can ! Right click on the "hellopiwigo.php" and select either :
"Run as" -> "PHP script"  : This will display the results in the "console" view (one of the tabs on the middle bottom pane) 
"Run as" -> "PHP Web page" : This will open an eclipse internal browser and show the results the same way.
Let's go back to Apache now: It would be great (and for testing purposes this will be rquired at some stage anyway ) to run our "debugTest" project in any browser outside. For that Apache has to find our project files and teherfore we have to edit the http.conf file which is located at C:\software\xampp\apache\conf\http.conf
Obviously there are many ways to do this I just do some simple configuration using an alias in order to map C:\workspace into the Apache webspace which is :  C:/software/xampp/htdocs
So in the http.conf file add below  "<IfModule alias_module>" the following :
Alias /debugTest C:/workspace/debugTest
<Directory C:/workspace/debugTest>
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
( Here you just may do the same with the directory where you want to install piwigo later :. If you call the eclipse project piwigo in the same workspace as our example put in an alias for  "C:/workspace/piwigo" just as before )
Save, stop and start Apache in the xampp control panel. Open you favorite browser and go to http://localhost/debugTest/hellopiwigo.php You should have the same results as in eclipse. Change, in eclipse, something e.g. "Hello" to "Salut" save and refresh the browser you should see the changes.
Now you can start debugging and play around and explore the debugger view in eclipse. For that right click on "hellopiwigo.php" -> "Debug as" -> "PHP script"
Now i leave it to you to do some more exploration. I will come back with a separate post for getting piwigo going in the dev environment.

Pied de page des forums

Propulsé par FluxBB

github twitter newsletter Faire un don Piwigo.org © 2002-2024 · Contact