Mar 29

Enabling PHP on Leopard

Posted by James Netherton | Saturday 29 March 2008 12:32 PM | In PHP,Mac

This post refers to the default Apache HTTP server that ships with Leopard. By default it doesn't load PHP5 which also comes pre-installed with Leopard. Here's how to enable the PHP module.

Open up a terminal session and run through the following steps:

1. sudo vi /private/etc/apache2/httpd.conf
2. Search for the string "php" by typing /php [return]
3. Hopefully you'll have found the line starting, #LoadModule php5_module
4. Remove the # symbol before the LoadModule statement
5. Exit vi and save the file, :wq!

That should be all there is to it. You can start the mac web server and you'll be able to start serving up PHP templates. You will probably also want to do some customisation of PHP.ini. Here's how I did this:

cd /private/etc/
sudo mv php.ini.default php.ini

You're then free to start editing the ini file.

This isn't the greatest solution to get PHP running on Mac. It appears the compiled PHP version shipped with the Mac is missing some useful modules such as SOAP.

 

Oct 16

USB printing with Parallels

Posted by James Netherton | Tuesday 16 October 2007 5:00 AM | In Mac

I think this is in the Parallels FAQ's somewhere but I thought it'd be worth blogging about.

I was trying to setup my USB printer to work from Windows under Parallels on my Mac. I installed the relevant drivers but couldn't get Windows to recognise that my printer was connected via USB, even though it was configured fine in OS X.

The answer is to download and install Apple Bonjour for Windows. Once you have done this, open OS X System preferences and find your USB printer under the Printer & Fax section.

Then choose the Sharing tab and make sure your USB printer is selected for sharing. Then hop back to Windows and fire up the Bonjour printer wizard. Step through the wizard and you should be able to select your USB printer. Make sure you select the printer model as 'Generic / Postscript'. Complete the configuration and you'll be able to print via USB from Windows!

 

Sep 19

Fixing a broken bash profile on Mac

Posted by James Netherton | Wednesday 19 September 2007 12:29 PM | In Mac

If like me you start editing the PATH variable within your .bash_profile file without knowing what you're doing, there's the possibility that the next time you fire up the terminal, none of the usual commands will work.

You should be able to do this:

/usr/bin/vi .bash_profile

To edit and fix it.

 

Sep 16

Building the locate database on Mac

Posted by James Netherton | Sunday 16 September 2007 5:00 AM | In Mac

When I'm on the command line in the *nix world, I prefer to use the locate command for finding files and directories over the find command.

The first time you try and use locate, you'll probably be presented with something like:

locate: no database file /var/db/locate.database.

You need to build the locate database before using the command. Here's how you do it on the Mac....

sudo /usr/libexec/locate.updatedb

It will take a while to complete but you'll be able to use the locate command afterwards.