Environnement de développement avec MacPorts

Tagged:

Oulah ... comment ça marche encore ... ça fait longtemps que j'avais pas écrit un billet tiens ...

Bref j'ai récemment formaté mon mac pour y mettre leopard et profiter de ça pour tout refaire a neuf, avec fink et tous les soft que j'installais pour tester ... c'était devenu un enfer de s'en servir ... il était hyper lent et pour bosser avec c'était vraiment pas top ...

bref me revoila parti avec un beau leopard tout neuf et ça vaut bien le coup ...

Simplement j'avais ressenti pas mal de limitations avec MAMP et pour me passer de ces limitations et retrouver les nostalgies de la bidouille sous linux ... j'ai voulu installer tout ça moi même avec MacPorts ...

Voici le résumé de mes étapes pour y arriver :

pour macports

* Installer les dev tools de osx pour avoir un gcc qui va bien
* Installer macports

pour apache2

* sudo port install apache2
* cd /opt/local/apache2/conf
* sudo cp httpd.conf.sample httpd.conf
* modifier DocumentRoot, Directory et DirectoryIndex (index.php, index.html)
* Rajouter le AddType application/x-httpd-php .php

pour php5

* sudo port install php5 +apache2 +mysql5 +pear
* cd /opt/local/etc
* sudo cp php.ini-recommended php.ini
* modifier short_open_tag à On
* cd /opt/local/apache2/modules
* sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so

pour mysql5

* sudo port install mysql5 +server
* sudo -u mysql mysql_install_db5
* sudo -u mysql /opt/local/lib/mysql5/bin/mysqld_safe &
* sudo /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new_passwd'

ensuite pour le fun :

* sudo mkdir -p /etc/init.d/
* sudo ln -s /opt/local/apache2/bin/apachectl /etc/init.d/apache
* sudo vi /etc/init.d/mysql && sudo chmod +x /etc/init.d/mysql

dans ce script on y met :

#! /bin/bash
 
start () {
  /opt/local/lib/mysql5/bin/mysqld_safe &
  ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock
}
 
stop () {
  ps -a | grep mysqld | grep -v 'grep' | awk '{print $1}' | xargs kill -9
  if [ -h /tmp/mysql.sock ]; then rm /tmp/mysql.sock; fi
}
 
if [ $1 == 'start' ]; then
  echo "Starting mysql deamon"
  start
elif [ $1 == 'stop' ]; then
  echo "Stoping mysql"
  stop
elif [ $1 == 'restart' ]; then
  stop && start
else
        echo 'Usage mysql [start/stop/restart]'
fi

et voila :

* sudo /etc/init.d/apache start
* sudo /etc/init.d/mysql start

c'est partit :)

Comments

avec launchd il n'y a pas besoin d'écrire un script bash pour inet.d

la version MacPorts d'Apache2 comprte ce qu'il faut. il faut juste charger une plist :

###########################################################
# A startup item has been generated that will aid in
# starting apache2 with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
###########################################################

Vla la commande de barbar qu'il faut taper aussi ...

sudo /etc/init.d/apache2 start c'est quand même vachement plus classe ...

The first thing is to make it clear what the style of your dress is and what you are going to outline which part of your body. For instance, are you intending to show your long legs or sexy foot fingers? After that, your task is to find the shoes for you.

Qu'en est-il de la barbarie de contrôle Vla? Ceci est important je pense.