PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Installation sur les système Windows> <Installation sur un système Mac OS X
Last updated: Fri, 20 Jun 2008

view this page in

Compilation pour les clients MacOs

Les instructions suivantes devraient vous aider dans l'installation du module PHP pour le serveur web Apache inclus dans MacOS X. Cette version inclut le support pour les bases de données MySQL et PostgreSQL. Ces instructions proviennent généreusement de » Marc Liyanage.

Avertissement

Soyez prudent lorsque vous faites cela, vous risquez de détruire la configuration de votre serveur web Apache !

Faites ceci pour l'installation :

  1. Ouvrez une fenêtre de terminal
  2. Tapez wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz , et attendez la fin du téléchargement.
  3. Tapez gunzip libphp4.so.gz .
  4. Tapez sudo apxs -i -a -n php4 libphp4.so
  5. Maintenant, tapez sudo open -a TextEdit /etc/httpd/httpd.conf . TextEdit va ouvrir le fichier de configuration de votre serveur web. Recherchez les deux lignes suivantes, à la fin du fichier (utilisez la commande de recherche) :

    #AddType application/x-httpd-php .php 
    #AddType application/x-httpd-php-source .phps
    
    Supprimez les deux signes dièse (#), puis sauvez le fichier, et quittez TextEdit.

  6. Finalement, tapez sudo apachectl graceful pour redémarrer le serveur Apache.

PHP devrait être fonctionnel. Vous pouvez le tester en créant un fichier dans votre dossier "Sites", appelé "test.php". Dans ce fichier, écrivez la ligne : <?php phpinfo() ?>.

Maintenant, ouvrez votre navigateur à l'adresse suivante : 127.0.0.1/~your_username/test.php. Vous devriez obtenir la page d'information de phpinfo.



add a note add a note User Contributed Notes
Compilation pour les clients MacOs
mdoyle at cooperationireland dot org
07-Apr-2008 08:54
With OSX 10.5, the bundled version is up to date but didn't come with the modules I needed (notably I wanted the pgsql database extension).

Getting this to work was quite simple in the end, what made it difficult is the build-options for Apache. After searching on google, I found instructions to re-build apache with the following options:

./configure --enable-layout=Darwin --enable-mods-shared=all

(Step 1: download the latest Apache2.2 source files,
 Step 2: extract the tarball
 Step 3: ./configure --enable-layout=Darwin --enable-mods-shared=all
 Step 4: make all
 Step 5: sudo make install)

Without this step, when I rebuilt PHP either directly with the source from the PHP.net site or using MacPorts I was getting an error about the wrong architecture like this one:

httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found.  Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture

After re-building and Apache with the configuration above and  restarting it, everything worked again and I can now use PostgreSQL from within PHP on my MacBook Pro.
rahul
08-May-2007 01:54
if `wget` isn't installed or not in your path use `curl -O` instead.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites