Installing Symfony on MacOsX with php5 binary from entropy
Installing Symfony on MacOsX it's a bit tricky... But finally i accomplished the quest and this page is the result of my experience
Phase 1 - PHP5
Download and install the php binary package from this site http://www.entropy.ch/software/macosx/php/ (IMPORTANT! if you want to keep it simple use the binary for apache 1.3, that's the version bundled with osx 10.4)
now open a terminal window and type:
user:~ macbook$ cd /usr/bin
now you have to change name to the default php binary in order to use the php5 binary from the new installation:
user:~ macbook$ mv php php4
now you can create the symbolic link to the php5 binary:
user:~ macbook$ ln -s /usr/local/php5/bin/php php
repeat those two steps for pear:
user:~ macbook$ mv pear pear4 user:~ macbook$ ln -s /usr/local/php5/bin/pear pear
if you need the cli version of other php5 binaries (like phpize) repeat those steps
Phase 2 - Pear
pear (and other packages) needs to be upgraded in order to work with symfony:
user:~ macbook$ pear upgrade-all
if you encounter some problems try:
user:~ macbook$ pear upgrade pear
and then:
user:~ macbook$ pear update-channels
and again:
user:~ macbook$ pear upgrade-all
Phase 3 - Symfony
In order to install Symfony you need to set an higher memory limit in php.ini:
user:~ macbook$ vim /usr/local/php5/lib/php.ini
To find the right line type:
/memory limit
set the limit to 32M or more finally it's time to install Symfony:
user:~ macbook$ pear channel-discover pear.symfony-project.com user:~ macbook$ pear install symfony/symfony
now you can create a symbolic link to the symfony command to use it:
user:~ macbook$ ln -s /usr/local/php5/bin/symfony /usr/bin/symfony user:~ macbook$ ln -s /usr/local/php5/lib/php /usr/share/php
try it:
user:~ macbook$ symfony -V
Phase 4 - Creating a project
You can create a project in the WebServer root:
user:~ macbook$ cd /Library/WebServer/Documents/ user:~ macbook$ mkdir sfdemo user:~ macbook$ cd sfdemo user:~ macbook$ symfony new sfdemo user:~ macbook$ symfony app testapp user:~ macbook$ symfony module testapp testmodule
If you don't want to create an Apache virtual host you can simply create a symbolic link to the symfony data folder
user:~ macbook$ ln -s /usr/local/php5/lib/php/data/symfony/web/sf web/sf
now open NetInfo Manager, go to machines, duplicate localhost and change the name to sfdemo, move to another line and save try it in a browser http://sfdemo/sfdemo/web/testapp_dev.php
Instead if you want to set up a virtual host for your application simply open the httpd.conf file:
user:~ macbook$ vim /etc/httpd/httpd.conf
find the section of virtual hosts typing
/Section 3: Virtual Hosts
and add this lines:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
</VirtualHost>
<VirtualHost *:80>
ServerName sfdemo
DocumentRoot /Library/WebServer/Documents/sfdemo/web
DirectoryIndex index.php
Alias /sf /usr/local/php5/lib/php/data/symfony/web/sf
<Directory "/usr/local/php5/lib/php/data/symfony/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
You will need to restart apache
user:~ macbook$ sudo apachectl restart
now open NetInfo Manager, go to machines, duplicate localhost and change the name to sfdemo, move to another line and save try it in a browser http://sfdemo/testapp_dev.php
Phase 5 - SVN
Download and install the svn package from http://metissian.com/projects/macosx/subversion/ you can add the binary location ( /usr/local/bin ) simply by adding it in the /etc/profile file:
user:~ macbook$ vim /etc/profile
now the line should look like this:
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
Phase 6 - MySql
Download and install from http://dev.mysql.com/downloads/mysql/5.0.html#downloads (choose the right version between PowerPC 32bit, PowerPC 64bit and X86) you can add the binary location ( /usr/local/mysql/bin ) simply by adding it in the /etc/profile file (like for svn)
user:~ macbook$ vim /etc/profile
now the line should look like this:
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/mysql/bin"

