But if your application uses libraries installed with PEAR, then this extra functionality will not work for those libraries. However, this can be fixed by providing Eclipse with the locations of these libraries.
Note: Click on the screenshots below to see a larger image.
1. Right click on your PHP project and select "Properties".
2. Select "PHP Include Path" from the left-hand menu. Click the "Libraries" tab, then click "Add Library...".
3. Select "User Library" and click "Next".
4. Click "Configure...". Another new dialog will appear.
5. You want to add a new library, so click "New..." and type in a name for the library. I'm going to add PHPUnit.
6. Select the newly added Library and click "Add External folder...". This is where we point to the file system location of the library.
7. Select the path to the library. In Windows, PEAR installs its libraries inside the "PEAR" folder under the PHP installation directory. On Mac OSX, its location is "/usr/local/PEAR". On Ubuntu, it should be at "/usr/share/php/PEAR". If you can't figure out where your PEAR directory is, you can find it in the "include_path" setting in your php.ini file (when PEAR is installed, it automatically modifies the PHP include path to include itself). Click "OK".
In my next post, I'll explain how to run PHPUnit unit tests from Eclipse without needing any plugins!
Do you have any tips for developing in PHP on Eclipse? Let me know in the comments section!
7 comments:
Thank you, Mike !
your post was extremely helpful.
On Ubuntu PEAR usually located in
/usr/share/php/PEAR
Ivan
Thanks for the tidbit, Ivan!
Thanks! ^^
Hi Mike,
I can't open php code declaration. For example I have code like this
$sql = mysql_query($q);
I can't open mysql_query to see that declaration.
Do you know how to fix it on Eclipse?
I use Eclipse Helios and I have installed PDT Plugin to work with PHP
Anonymous, built-in functions like mysql_query are not actually written in PHP. I believe they are written in C and then compiled into the PHP language. To see the source code of these methods, you'd have to download the source code of the PHP language.
Thanks for giving great information for me. This is very useful for me. because i am a beginner for php.
Good to see your blog.
Post a Comment