Development

osXDevelopmentEnvironment

You must first sign up to be able to contribute.

Install DarwinPorts?

Follow the instructions carefully.

Using MySQL

Install MySQL:

sudo port install mysql4

Then to install PHP5 with Apache2 and MySQL4 support:

sudo port install php5 +macosx +mysql4 +apache2

Start MySQL:

/opt/local/bin/mysqld_safe &

Using Postgresql

Install the latest postgresql:

sudo port install postgres82

Initialize it:

cd ~
initdb -D pgdata
pg_ctl -D pgdata -l pgdata/psql.log start
createdb askeet
psql askeet

Install php5 with postgresql support:

sudo port install php5 +postgresql

If it complains about multiple versions of php5, deactivate the old version:

sudo port deactivate php5 @..someversion..

Then try to install again.

Apache2 configuration

Here we have the whole application compiled, now we do some setup:

  • Apache2 :
    1. You can add the apache2 support programs to your $PATH, just add /opt/local/apache2/bin" to the '~/'.profile file that is created when you setup DarwinPorts?
    2. In /opt/local/apache2/conf rename the httpd.conf.sample to httpd.conf and change the conf you want

PHP5 configuration

  • PHP5 :
    1. Go into /opt/local/apache2/modules and type /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
    2. Then it looks like a little bug hit darwinport, so to activate PHP5 in apache2, edit /opt/local/apache2/conf/httpd.conf and add this
      # php5 settings
      Include conf/extras-conf/mod_php.conf
      
    3. Rename either /opt/local/etc/php.ini-dist or /opt/local/etc/php.ini-recommended to /opt/local/etc/php.ini
    4. Currently PEAR is no longer included with PHP5 in DarwinPorts?. So we use PEAR from OS X itself. So we need to enable that in php.ini. Search for include_path and edit the line so it reads as follows:
      ; UNIX: "/path1:/path2"
      ;include_path = ".:/php/includes
      include_path = ".:/php/includes:bin/lib:/opt/local/lib/php:/usr/lib/php/"
      
    5. To really use PEAR with PHP5 from DarwinPorts? you will need to add the following to your .profile:
      export PHP_PEAR_PHP_BIN=/opt/local/bin/php
      
  • MySQL4
    1. Change ownership:
      chown -R mysql:mysql /opt/local/var/db
      chown -R mysql:mysql /opt/local/var/run/mysqld
      chown -R mysql:mysql /opt/local/var/log/mysql
      
    2. Create the default database:
      sudo -u /opt/local/bin/mysql_install_db --user=mysql
      

Et voila! It's done. Now you can run as root :

/opt/local/apache2/bin/apachectl start

Virtual hosts

You can change /opt/local/apache2/conf/extra/httpd-vhost.conf to add your symfony virtual host:

<Directory "/opt/local/lib/php/data/symfony/web/sf">
        AllowOverride All
        Allow from All
</Directory>

<VirtualHost askeet:*>
 ServerName askeet
 DocumentRoot "/symfony/askeet/web"
 DirectoryIndex index.php
 Alias /sf /opt/local/lib/php/data/symfony/web/sf

 <Directory "/symfony/askeet/web">
  AllowOverride All
  Allow from All
 </Directory>
</VirtualHost>

Don't forget to change your /etc/hosts as well:

127.0.0.1       askeet