Welcome to LjGww's Blog

Here we will see...

Sunday, February 13, 2011


Let's C where am I...... First, I am on Mac OS X (macosx) so many choices are based on decision shall something will run on what I have.

I got the idea about Eclipse... a particular one Eclipse for PHP. Okay.

This is the story: I want to write some complex project in PHP. I can do it with good ascii editor, since I am on Mac, barebones is my choice of text edit tool, barebones have been market leader for ascii and mac for years, to my knowing (if you know something better, let me know). No means for full fledged barebones,  so excellent free version for now. Recommended.

Writing php code goes in development circles. Type, save, switch to browser, hope it works, go back edit, save... I do not mind that mantra - it is everyday's programmers prayer. Yet, it would be helpful if there is some easier way. Hop, jumps in friend of mine that spends his days in Java and says "Eclipse!". I say, OOOOkay but I am not Java, and he says "but Eclipse is not only for Java".

Then it starts.....

Got eclipse for PHP. Gosh.... took me about 2-3 days to get myself familiar with it. I admit. Not easy. And I am not new to RAD/IDE's seen many in many years. But, after some wrestling with Eclipse, I got an idea how to make it work with XAMPP. Not very logical solution for me, but it works.

Strange animal Eclipse for PHP.

Now. If you just get an eclipse for php on its own you may find yourself puzzling how to make it to "debug" the code as it nicely allows to "edit" code and "run" it (although even this "run" is a bit awkward since the only browser it "recognizes" is Mozilla and "internal" browser. Wander why.

I am fond of some other browser namely Camino and Chrome (shall I link it? no.... - google it). However Eclipse gives up on finding these two in "production". 

Second thing that puzzles me with EfP (Eclipse for PHP) is that there is no "deployment" i would expect. Okay PHP is not "compiled" so "build" is a bit awkward to contemplate yet it would be logical to be a "copy" to a web server "build" folder. Wander why this is not done in this way. Only way I made it work is to use "source" directly from web servers folders (see above XAMPP - it makes "local" web server).  Okay it could be because you may be confused with double sources in two different places but still it is logical for me to have "source" and "build" and then remote "deployment".

Third thing that have caught interest in along the research about PHP tools, is CVS systems, not that I need to share code but out of curiosity.... By researching some pointers I stepped on PHPunit that propose to be used to "test" PHP code. From one side PHP comes with PEAR which is in my view an extendable "class library" - extremely nice thing from PHP makers and contributors - many useful tools!

So I have found git and github since it seems to be place of choice for PHPunit.

Took me several hours to configure git.... Luckilly i've been on UNIXes for years.... surely not mac staff. On the way I found a problem that I need "root" access for Mac (which is disabled) and found excellent hint on Mac OS X Hints

GitX is still puzzling me as to be proposed "easy" git interface (in which I do not find myself around except to browse what I managed to do with git on a command line) Nice tool but still poorly documented. Maybe by the time it would develop into something more useful than kind-a viewer (as I see it).

Retracing from "git"-ting i found that Eclipse uses SVN. Okay will try to do it later sometimes.

Gone back to Eclipse. This time debugger.... Eh. Seems that there are some two ways to make it work. One of ways is to have Zend Engine.

Zend being commercial, is kind to have a "community" edition. And there is version of Eclipse bound (as far as I understand) with Zend and its called PDT

That did not click with XAMPP i am using. So I have grabbed Zend Server separately in order to be able to debug.

It took me a while to understand how Zend was supposed to work. Which is much worse, Zend tends to "live" out of MacOSX file tree and gets installed in "Darwin" UNIX places (which makes tedious other things).

I also grabbed "bound" version but it turned out to be older than latest Eclipse for PHP.

So another hurdle with setting Eclipse to work with Zend Server.... and found out that it does not like Apache "URL rewriting" systems. Whenever you find yourself between several producers - apache, php, zend, eclipse... it starts to feel like "bermuda triangle" lot of resources - do this with this, do that with that.... pretty tedious to find your way around. So it comes handy years of hacking httpd.conf (as to change default users so I can edit files from MacOSX) and other UNIX skills. Zend Controller that comes with Zend Server is maximally puzzling application (did not find what it is for as yet).

But I managed to make it working .... 


XAMPP working on standard web ports
Zend Server working on ports 10000+
Eclipse debugging PHP code as PHP script and as WEB script...
Two workspaces - one for XAMPP one for Zend.
now I am set to explore some PHP code.....

And so it goes on my GitHub https://github.com/ljgww