Daddy's back!

cover from this month's issue of Empire Magazine

Not too long ago back in '99 I did some work for this amazing company; based in their London Docklands office building up their tech-team.
Today a friend dropped me a line about a new service Reuters is offering which looks pretty nice.
It's based around something like SharePoint providing a portal for all your business news, reports, post questions, blogs, etc. within the news network.
I'm saying Sharepoint, but now looking into the source I have to say I'm quite surprised!
The actual system is powered by Prototype with the FCKEditor providing textual input into the the system. Prototype obviously provides the AJAX functionality as (like mootools) it's one of the major JavaScript-AJAX libraries around, (and being plugged into Rails from the start is just a bit popular).
Will wait and see how it goes, but so far the service is pretty promising.
Take a look for yourself...
Being a developer and today being my trip to the dentist (and a day off work), I tend to get bored really really easy.
And knowing tomorrow I've got to work with JSON I thought I'd show you how easy it is to install and compile Apache 2.2 Web Server and Enable PHP 4 on your MacBook, so you can get to and build PHP apps natively on OSX.
Now obviously you could download MAMP to get up and running fast, but really that's just not geeky enough for us hard-core developers, so let's begin.
Yes, to build from source you're going to need the GCC compiler which can be obtained for the Apple Developer Connection website (free), search my searchbox for a link otherwise just download from their site.
First goto the Apache site and download the latest sourcecode to your desktop.
Once downloaded, do the following in your TERMINAL window;
cd desktop
gnutar -xzf httpd-2.2.6.tar.gz
cd httpd-2.2.6
Now we've untar'd it to the desktop and have navigated into it, let's build from source.
Run this to setup the sourcefiles for your machine and build spec,
./configure --enable-module=most --enable-shared=max
Now compile the sourcecode, and install
make
sudo make install
Bingo, you now have Apache 2.2 (or whatever version your downloaded) installed on your MacBook.
Start with...
sudo /usr/local/apache2/bin/apachectl restart
Stop with...
sudo /usr/local/apache2/bin/apachectl stop
Now every MacBook comes with PHP4 installed as standard, it just waits until you enable it to work.
So to enable it, type in TERMINAL;
cd /etc/httpd
sudo mate httpd.conf
This will navigate to the httpd Apache config file and open it's INI file in TextMate (I'm baised but you can use NANO or TextEdit if you like to edit the file).
When you've got the file open, search for 'PHP' anywhere in the file.
You should see two occurences, commented out with #'s remove these to enable PHP.
# LoadModule php4_module libexec/httpd/libphp4.so
# AddModule mod_php4.c
Now save and close the file
And restart Apache
sudo apachectl restart
Stop with...
sudo apachectl stop
Now what this will do is startup your Mac's native Apache server (which isn't 2.2), sorry but I haven't worked that one out.
Your fresh 2.2 build will also have an *httpd.conf file in...
cd /usr/local/apache2/conf
sudo mate httpd.conf
To edit it's config file, sorry I haven't an answer at the moment but I'll figure it out.
Next question,
First make sure Personal Web Sharing is enabled in System Preferences / Sharing.
Next in your user directory (or the first directory you appear in when opening TERMINAL), create a directory called...
mkdir Sites
Now everything you stick in this directory will be acted upon like it's a website (including PHP).
To test your PHP setup works, create a file in there called test.php and add this in it...
<?php phpinfo() ?>
Now before you leave System Preferences / Sharing, click the info link by Personal Web Sharing.
This will display a dialog and at the bottom of this will be some web addresses, the one's for the web server running on your machine!
Click on one and bookmark the link.
Add /test.php to the end and run it in Firefox or Safari, you should now see the version of PHP installed on your system.
Well done, you have now successfully installed PHP and Apache2 from source on your MacBook.
Enjoy and when I can figure out how to replace Apple's native 1.3 Apache server with 2.2 I'll let you know, but for now it works.
The engines plugin enhances Rails plugins — allowing sharing of code, views and other aspects of your application in a clear and managed way.
ala..
script/plugin discover
script/plugin install engines
Like what it says on the tin, it allows you to use javascript+css to dynamically replace static html text with more fancy flash fonts; but without the need to photoshop any images...
first install the Engine plugin (above) then do...
script/plugin install http://svn.rails-engines.org/plugins/engines
script/plugin install svn://rubyforge.org/var/svn/sifrhelper
A note on permissions from the Typo README:
"Typo needs write access to several directories in order to function correctly. These need to be writable by the user that runs the Typo process--in a hosted environment this may be your user; on dedicated systems it may be something like 'httpd' or 'www-data'.
The specific directories in question are 'log/' (and everything underneath it), 'cache/', and 'public/'. Strictly speaking, Rails will continue to work if public isn't writable, but Typo's page caching code will work properly and this will cause Typo to be slower and use much more CPU time. For the security conscious, Rails really only needs the ability to change a half-dozen files and subdirectories under public/, ask on the Typo mailing list for more details.
aka...
cd /mytypoinstall
mkdir cache
chmod -R a+rw cache
chmod -R a+rw public
chmod -R a+rw log
Done.