To use this guide you need:
I've written this guide using purely terminal / shell commands because various parts just can't be done through a GUI, and if we are forced to use the terminal anyway, it'll be easier to do everything through the terminal. If your not completely familiar with a terminal, just make sure to follow the instructions to the letter, and copy and paste every command line by line (not several at the same time), and you should be able to complete this guide successfully.
Through out the guide I'll be using 'nano' as my command line text editor, the important details to know are:
To open a file you type 'nano FileName.foo', and to close and save it you press CTRL and X simultaniously, then it will ask you "Save modified buffer", press "y" to continue saving it, and press ENTER when it asks for the file name to use (so it uses the original name). For a more complete guide to nano see this howo
The build in PHP version on Mac OS X unfortunately is missing some key extensions that we require for a working Shindig and Partuza setup, so instead we'll be using 'entropy's' build which has everything we need build in already.
I'll assume you didn't enable the build in PHP version which is disabled by default; If you did, comment out the LoadModule statement in your apache config.
To install it:
Open your terminal app (Applications -> Utilities or look for 'terminal' in spotlight) and at the command line type in:
curl -O http://www2.entropy.ch/download/php5-5.2.5-6-beta.tar.gz tar xvfz php5-5.2.5-6-beta.tar.gz sudo mv php5 /usr/local/
sudo chown -R root:admin /usr/local/php5 sudo ln -sf /usr/local/php5/entropy-php.conf /etc/apache2/other/+entropy-php.conf sudo apachectl restart
Next we'll test to see if our instalation worked and if PHP is enabled for your web server:
cd /Library/WebServer/Documents/ sudo nano info.php
and in the text editor type in:
<?php phpinfo();
Press CTRL-X to close & save the file, press 'Y' and ENTER to close and save it.
When you now open your browser and point it at http://localhost/info.php If all went well, you should see the php information page and the version should read: "PHP Version 5.2.5 www.entropy.ch Release 6". If so, congratulations, you now have a working PHP instalation on your Mac!
Note: To make the web server start up automatically on your mac goto your System Preferences, select Sharing and check "Web Sharing"
Next up we'll check out Shindig's and Partuza's from their SVN repositories, open up your terminal and type:
cd /Library/WebServer/Documents/ svn co http://svn.apache.org/repos/asf/incubator/shindig/trunk/ shindig svn checkout http://partuza.googlecode.com/svn/trunk/ partuza
chmod 777 partuza/html/images/people
FYI: The chmod command is required to let the web server , who is running under a different user name & permission, to write it's generated thumbnails to that directory.
Personally i prefer to have my projects that I'm working on linked in my home directory, so that they are easier to find and work with, so to setup these links do:
cd ~ ln -s /Library/WebServer/Documents/shindig shindig ln -s /Library/WebServer/Documents/partuza partuza
Now we need to tell the web server about our 2 new sites that we want to run, and configure PHP for Partuza and Shindig.
First we'll create 2 host names that apache can use to identify the sites by adding them to our /etc/hosts file:
sudo nano /etc/hosts
and change the "127.0.0.1 localhost" line to:
127.0.0.1 localhost shindig partuza
Close and save the file, and we'll go add the hosts to Apache.
Hint: you can look for text in the open document in nano using CTRL+W, and then typing in what you looking for; This will be a real time saver in the next part.
sudo nano /etc/apache2/httpd.conf
And then look for the line that reads:
#Include /private/etc/apache2/extra/httpd-vhosts.conf
and change it too (remove the #):
Include /private/etc/apache2/extra/httpd-vhosts.conf
Close and save the file, and we'll go add our virtual hosts:
sudo nano /etc/apache2/extra/httpd-vhosts.conf
Now the example virtual hosts listed in this file are invalid and will cause Apache to refuse to start up, so we need to remove them first. You can do this by moving your cursor to the first line of:
# VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block.
And then press CTRL+K until you've removed everything after it, the file should then look like:
# # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80
Then we're ready to add the virtual host configurations for Shindig and Partuza, edit the file to look like:
# # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80 <VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost> <VirtualHost *:80> ServerName shindig DocumentRoot /Library/WebServer/Documents/shindig/php <Directory /Library/WebServer/Documents/shindig/php> AllowOverride All </Directory> </VirtualHost> <VirtualHost *:80> ServerName partuza DocumentRoot /Library/WebServer/Documents/partuza/html <Directory /Library/WebServer/Documents/partuza/html> AllowOverride All </Directory> </VirtualHost>
Note: When you configure apache to use virtual hosts and then goto a host name it doesn't have a configuration for, it will automatically pick the first one. So to keep our original behaviour in tact, we've added the original DocumentRoot as the first virtual host.
Next up we need to setup and tweak our php.ini:
cd /usr/local/php5/lib sudo mv php.ini-recommended php.ini sudo nano php.ini
Now we need to look for
short_open_tag = Off
and change it too:
short_open_tag = On
And then we are ready to ready to restart the web server for the changes to take:
sudo apachectl restart
To make sure everything worked so far, point your browser to : http://shindig/gadgets/ifr?url=http%3A%2F%2Fwww.google.com%2Fig%2Fmodules%2Fhoroscope.xml
If you see a horoscope displayed, everything went well so far! If not, go over the previous steps, and make sure you didn't accidently skip one of them :)
Next up, we need to setup and configure the MySQL database that Partuza will use:
Goto http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg and select the "Mac OS X 10.5" download link ("Pick a mirror"), i personally used the (x86_64) version, but the (x86) will work fine too.
On the following page you can select "ยป No thanks, just take me to the downloads!" to skip over the registration process, and then select a mirror to actually download the package from.
If your downloading in Safari the .dmg file will automatically be mounted and opened for you, however if your using firefox you'll have to manually mount and open the .dmg file.
Run the installer by double clicking on the mysql-5.0.67.osx10.5-x86_64.pkg, go through the installer using the default choices, and once that is completed, do the same for the MySQLStartupItem.pkg, and after that is completed double click on the 'MySQL.prefPane'.
In the dialog you get then, select 'Install for all users', and after entering your password, check 'Automatically Start MySQL on Startup' and click on the 'Start MySQL Server' button.
To make sure the mysql command line programs can be executed from the terminal, we'll add the mysql directory to our global system profile:
sudo nano /etc/profile
and at the bottom of the file add:
PATH=$PATH:/usr/local/mysql/bin export PATH
Close and save this by doing the usual CTRL-X, Y, Enter.
And if you close your terminal (Apple-Q), and re-open it again and type in mysql you should see something like this:
$ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 42 Server version: 5.0.67 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Type in 'exit' (return) to leave the mysql shell again. Congratulations, you have a working MySQL instalation on your mac now!
First we'll have to create the database that Partuza will use:
cd /Library/WebServer/Documents/partuza/ sudo mysqladmin create partuza sudo mysql partuza < partuza.sql
Note: if you want to access the partuza database from the command line either use 'sudo mysql partuza', or 'mysql -u root partuza'.
Next we'll configure Shindig to use Partuza's data handler:
cd /Library/WebServer/Documents/shindig/php/config nano local.php
And enter the following configuration values:
<?php
$shindigConfig = array(
'person_service' => 'PartuzaService',
'activity_service' => 'PartuzaService',
'app_data_service' => 'PartuzaService',
'messages_service' => 'PartuzaService',
'oauth_lookup_service' => 'PartuzaOAuthLookupService',
'extension_class_paths' => '/Library/WebServer/Documents/partuza/Shindig'
);
Note: The values in local.php override the default values of container.php; This way you can svn update and/or upgrade between releases without any conflicts or loosing your configuration.
Now Shindig will know what classes to use for the social api data requests, and what path to load them from.
Your Mac should be completely configured now for running Shindig and Partuza: Point your browser to http://partuza/ to try it out!
Click on the register link at the top navigation bar, enter your information, and you should be re-directed to your profile edit screen where you can expand your profile information & upload a profile pictire.
Click on the 'edit' link next to Applications on the left navigation bar to add an OpenSocial gadget to your profile, enter 'http://www.labpixies.com/campaigns/todo/todo.xml' into the "Or add an application by url" text box, click 'Add Application', and you should be redirected too the canvas view of the todo gadget.
This concludes our Setting up Shindig and Partuza on a Mac guide. I hope you found it useful, and if you have any questions or want to talk to the Shindig or Partuza devs, come visit us at our mailing lists:
Note: If you want signed requests to work (which you do at some point), make sure to read shindig/php/certs/README on how to generate a public/private key pair and configuring the passphrase in shindig's configuration
The following two steps are optional, they are not required to run Shindig and Partuza, however they can enhance your development experience.
To intergrate the your new php version better on your mac:
sudo su - cd /usr/bin/ rm php* ln -s /usr/local/php5/bin/php ln -s /usr/local/php5/bin/phpize ln -s /usr/local/php5/bin/php-config ln -s /usr/local/php5/bin/pear ln -s /usr/local/php5/bin/pecl cd /usr/share ln -s /usr/local/php5/lib/php pear cd /etc rm -f php.ini ln -s /usr/local/php5/lib/php.ini
Installing APC (Alternative PHP Cache)
Installing PHP Extensions on a Mac unfortunately is a bit more complicated then it should be. For example to install APC to speed up your PHP instalation (do the intergration steps above first btw), download the .tar.gz from http://pecl.php.net/package/APC, unpack it, cd into the APC-X.Y.Y directory, run 'phpize', and configure it using (make sure there are no line breaks):
MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load" ./configure
and then type make, and sudo make install and add extension=apc.so to the /usr/local/php5/lib/php.ini
Enjoy!
Chris Chabot
http://www.chabotc.com