Loading...
 
Skip to main content

History: Developing TikiWiki with Eclipse on a Mac

Source of version: 17 (current)

Copy to clipboard
            ! Developing TikiWiki with Eclipse on a Mac
''Initially this page documents [http://doc.tiki.org/tiki-user_information.php?userId=8515|my] experiences setting up Eclipse on an Intel Mac (June/July 2008)''
* Using Eclipse and the ''right'' plugins you can set up an excellent development environment for working on TikiWiki or other PHP web application for free!
* As Eclipse is Java based this will work on any platform that support Java, but there are hints here for getting it to work properly on a Mac (it's not entirely straightforward)
* You will need some experience with the command line (the Terminal app) but hopefully I'll spell things out clearly enough for most people.

!! The basic setup
What is described below is based on Mac OS 10.4 (Tiger) running on an Intel Mac. 10.5 (Leopard) has a different Apache/PHP setup so some modifications will be required (I have added a few notes about getting this to work on Leopard). I also have PHP 5 installed (in /usr/local) which needs some special handling later on (I still had to install PHP5 using the entropy.ch package as described [http://michael.tyson.id.au/archives/579-Replacing-the-existing-Leopard-PHP-installation-with-a-more-complete-version.html|here] as the built in PHP doesn't let you add extensions).

To do the whole thing will probably take you an hour or two - the main struggle is getting the PHP debugger working which you might not need (in which case I would recommend using Aptana with the Subclipse plugin).

!!! Get Eclipse
It seems a new version has just come out (3.4) but i'm using 3.3.2, so I'll base these instructions on that. You might get it to work (especially on Linux or Windows) with latest versions of everything.
So go [http://download.eclipse.org/eclipse/downloads/|here] and download and install version 3.3.2. Run the Update Manager (Help->Software Updates->Find and Install...) and get it to check for updates, which should find the 3.3.3 core update (not sure if that's important, but again, it worked for me)

^Oops! Just spotted this [tiki-index.php?page=Eclipse&structure=Documentation|page] - most of this should be there... i guess^

!!! Get Subclipse
Subclipse is an Eclipse plugin that deals with SVN (the source control system used now for releases 1.10 onwards). This is where you get the latest version of all the files that make up TikiWiki.
Follow the instructions [http://subclipse.tigris.org/install.html|here] to install it.

!!! Get Tiki!
* Select File->New->Other... then pick SVN->Checkout projects from SVN, then Next>
* Select "Create new repository location", Next> and add "https://tikiwiki.svn.sourceforge.net/svnroot/tikiwiki" as the Url.
* After a short time you will be asked to select the folder to be checked out. Choose branches/1.10 then Next>
* Select "Check out as a project in the workspace" (for an easy life) and call the project something useful (like tikiwiki-1.10)
* Next> lets you choose where to save the project if you like
* Then click Finish.
* Go and make some tea (or sit there watching it if you don't want to come back to an error or a thing asking "Are you sure?" ;)

You should now have a local copy of the latest version of the source code (etc) and when people make changes you can easily download them by right (or ctrl) clicking on the project folder icon in the "Explorer" panel and selecting Team->Update. Lots more info on this, and on how to submit your changes on [http://dev.tiki.org].

!!! Get PDT (PHP features for Eclipse)
Use the same method as for Subclipse to add a new remote update site for the URL http://download.eclipse.org/tools/pdt/updates/ - but, when you check the "sites to visit while looking for new features" also check the "Europa Discovery Site" as there are some other things from there PDT needs.
You need to un-check "Show the latest version of a feature only" as we (on a Mac anyway) need to pick version 1.0.2 (1.0.3 is the current release as of writing).
You might need to mess about with "Select Required" to get it to find the extra features needed, I find selecting and opening the Europa Discovery Site and doing this seems to get it right eventually. (hmmm - it doesn't seem to be showing 1.0.2 for me at the moment but I think that's because I already have 1.0.2 installed)

!!! Get smartypdt (Smarty Support for PDT)
This one has to be downloaded from [http://code.google.com/p/smartypdt/]. Instructions to install from a "New Local Site" can be found there too.
Smarty is the template system used on TikiWiki and this plugin colourises (and i think error checks) Smarty tepmplate files (ending .tpl)

Note, it seems you need version 0.5.5 for this set-up - that's available [http://smartypdt.googlecode.com/issues/attachment?aid=-4286508249986580739&name=Smarty-PDT_0.5.5.zip|here] at the moment.

!!! Get xdebug (Debugger and profiler for tool PHP)
This is one of the two debuggers PDT supports. I couldn't get the Zend one working as I think you need to buy the whole "Zend Platform" - so i moved on to the other one [http://www.xdebug.org/]
''Now the fun begins!''

Xdebug is an extension for Apache and you install it by adding the line:
{CODE()}
zend_extension=/full/path/to/your/xdebug.so (or .dll for Windows)
{CODE} to your php.ini file (see [http://www.xdebug.org/docs/install|here] for more info)

I found a slightly different way to do this [http://www.vividreflection.com/blog/installing-xdebug-on-macosx/|here] (using a 80-extension-xdebug.ini file) but i don't think that's completely necessary - but here is my full ini block (it should be the same in the php.ini file)
{CODE()}
[xdebug]
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug
xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.idekey=ECLIPSE_XDEBUG
xdebug.collect_vars=1
xdebug.collect_params=4; 0=default min, 4 max info
{CODE}
__But__ first you have to have a compiled version of xdebug, and there are several available ([http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging|here] for instance) prebuilt for all platforms, including Intel Mac, but i couldn't get any of them to work.
!!!!Mac peculiarities
For the non-Mac platforms this should now all work as expected but the Mac version of xdebug seems to have compatibility problems with later versions of PDT (e.g. we need PDT 1.0.2), and you need to build a slightly old version of xdebug specifically match your system apparently. So... deep breath, and:

* Download version 2.0.2 of xdebug from [http://www.xdebug.org/link.php?url=xdebug202] 

Now according to [http://www.xdebug.org/docs/install|the instructions] to compile xdebug you need to run phpize (on the source directory). This needs something called autoconf, which in turn needs something called m4 (I said it was grim). These seem to be included in Leopard so the next two steps are for Tiger only.

* So download the [http://ftp.gnu.org/gnu/m4/m4-1.4.11.tar.bz2|m4 source] and build it (basically ./configure; make; sudo make install but the instructions are in the INSTALL file) (Tiger only)

* Then download autoconf from [http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.bz2|here] and again do ./configure; make; sudo make install (Tiger only)

* Now you should be able to build xdebug, first you have to cd to the xdebug source dir and run "phpize". It has to be the right version of phpise so on my system I have to do {CODE()}/usr/local/php5/bin/phpize{CODE} because we are using Entropy PHP 5%%%For Leopard I had to do {CODE()}sudo /usr/local/php5/bin/phpize{CODE}

* Then again because of my setup I have to do {CODE()}./configure --enable-xdebug --with-php-config=/usr/local/php5/bin/php-config
make{CODE}For Leopard you seem to need an extra directive like this: {CODE()}CFLAGS='-arch x86_64' ./configure --enable-xdebug --with-php-config=/usr/local/php5/bin/php-config
make{CODE}Thanks for this tip - it came from [http://www.designified.com/blog/article/60/compiling-installing-xdebug-for-php-525-entropych-build-on-os-x-105|here] where you will find complete instructions.

* This builds the file xdebug-2.0.2/modules/xdebug.so which you need to copy to somewhere Apache can find it (/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug for me)

''This works as of June 2008, but i'm sure soon there will be an easier way to get there but I really have to get on with some actual debugging now!''

!!Ok, so did it work?

Open phpinfo() in your browser - there's one on the TikiWiki admin menu - for instance http://localhost/tiki/tiki-phpinfo.php and you should see a block about xdebug showing the version and properties. If not something went wrong, probably with the phpize bit.

Then open Eclipse and set up a "PHP Web Page" debug session - there are several pages to show you how [http://wiki.eclipse.org/PDT/TUTORIALS|here].
Don't forget you're setting up a PHP web page debugger using PDT and XDebug (don't get lost in the Java debugging stuff)
---
Sorry this is short of screen-shots and possibly a little more conusing than it need be - I will try to tidy it up soon... promise.
Hope it helps!