Setting up PHP and web server on OS X 10.5 (Leopard)

Your shiny Mac comes preinstalled with a web server and php but you need to set it up to get going. Starting the web server is as easy as enabling “Web Sharing” under networks settings. I did this but the server did not respond at http://localhost. So, what was wrong?

Well, I recently upgraded my hard drive to a 500GB version and I used Time Machine to restore my operating system. The problem is that this is not a clone of my previous setup but a copy and it leaves out certain files that Time Machine ignores to save space. One of those folders is the apache web server log folder which is required by apache at startup. Unfortunately OS X doesn’t tell you anything about this error when you enable Web Sharing, it just doesn’t work.

Anyhow, simply create the folder:

sudo mkdir /private/var/log/apache2

and you’re good to go. You might have to disable and enable Web Sharing again to restart the process.

So, now the web server is running. What about php? Edit the apache config file located at /etc/apache2/httpd.conf and remove the ‘#’ (comment) from the line that says:

LoadModule php5_module

Now you can test that it works by adding a file called helloworld.php to the folder /Library/WebServer/Documents. Add the following code snippet to the file:


< ?php
echo 'Hello World!';
?>

And point a browser to http://localhost/helloworld.php. Now three things can happen. 1) no response. Did you restart the server? 2) The exact content of the file is shown in the browser. This means the PHP module is not loaded. Make sure the httpd.conf file has the comment character removed as described above and then restart the web server by disabling and then enabling web sharing again. 3) Hello World! (and nothing else) is printed in the browser. Success!

The next step is probably to set up MySQL. Here are some resources for doing that. Good luck and happy PHP hacking.

Posted in Software | 1 Comment

Upgrading RAM memory on Asus EEE B202, Eee Box

A short video I made showing how to replace a memory chip on the Asus EEE B202 desktop computer:

Read this post for further details on how to perform the surgery. Removing the side cover was the most tricky part but putting it back together was done in a snap:

The B202 supports 2 GB RAM and has two sockets. I only use one socket with a 2048MB DDR2 PC2-5300 667MHz memory module.

The B202 is a nice little machine. Cheap, virtually silent and with low power consumption but still fast enough to use as a developer machine.

Posted in Software | Tagged , , , , | 2 Comments

Sony Ericsson G502: excellent developer phone

sony ericsson g502 java

I wrote a short review of the G502 over at the Mobile Web Tablet. If you’re looking for a cheap but functional phone to do some mobile java development, this is it.

Posted in Software | Leave a comment

Running JBoss 4.2.3 on OSX

A simple gotcha, but anyway… If you get an exception like:

java.lang.NoClassDefFoundError: javax/ejb/Stateless
at org.jboss.ejb3.EJB3Util.isStateless(EJB3Util.java:42)

When trying to run jboss 4.2.3 on OSX, it’s because you’re using java 1.5 in stead of 1.6. Follow the instructions here to change.

Updated:…and then of course Eclipse stops working. Here’s how to update.

Posted in Software | Tagged , , | 1 Comment

Share keyboard and mouse between OS X and XP


(It’s more fun when you’re two. Photo by me.)

While I love my Macbook there are still a few programs I need Windows XP to run, especially when you’re doing MIDP development as I happen to be doing at the moment.

So, I had to dust of my old PC and put it beneath my rather small desk. The problem then is that I don’t have room for two keyboards. What to do?

Synergy to the rescue!

Synergy is a program that lets you share mouse and keyboard between two computers using the network. It works really nice, even with simple copy-paste between the OSs.

The installation is not quite as straight forward as one might like so here’s a video showing how to set it up.

Posted in Software | Tagged , , , | 3 Comments

Learning a new language


(Photo by me).

I just started reading a book about Cocoa Programming for OS X. (This one). Cocoa uses Objective C, which is somewhat different from C, C++ or Java that I’m more familiar with.

Learning a new programming language is really like entering a new world. You are naked. You don’t know how to solve even the most basic task. It’s a bit scary but also refreshing. You’re being forced to think out of your ordinary little box.

I should do this more often.

Posted in Software | Tagged , , | Leave a comment

JMUnit: simple and good enough

I ended up using JMUnit for my mobile java project. The Sony Ericsson jUnit tool is great when you have to run the tests from a PC on a real device or from a “real” jUnit application. It’s a more advanced tool, but for my needs at the moment, it’s a bit overkill.

So I ended up with what can only be described as the direct opposite: JMUnit is extremey simple. If I change my mind in the future, converting the test cases to jUnit shouldn’t be too difficult.

Posted in Software | Tagged , , , , , , | 1 Comment

Unit testing java mobile

I used to work for Sony Ericsson and my first job for the company was developing the J2ME SDK. The last thing I did as a developer was initiating the Mobile jUnit development (another guy finished it, though, and he should get the credit for it becoming a great tool.)

This was a couple of years ago and now when I am in the need for a unit testing framework for Java ME it seems not much has happened. There seems to be basically three options and none of them seems very actively developed. I wonder why.

Posted in Software | Tagged , , , , | 1 Comment

Using iMacros for testing

I’ll try using the iMacros Firefox plugin for testing a web service I’m developing. Will get back on how good it works.

Speaking of Firefox plugins, Firebug is a must have if you’re doing web development.

Updated: a quick test and comparison to Selenium makes the latter the winner for testing.

Posted in Software | Tagged , , | 3 Comments