Compilando para o MacOS X - Versão Cliente

As instruções seguintes ajudarão você a instalar o módulo PHP para o servidor web Apache incluso no MacOS X. Essa versão inclui suporte para os bancos de dados MySQL e PostgreSQL. Essas instruções foram providas por » Marc Liyanage.

Aviso

Tenha cuidado quando for fazer isso, vocêo pode estragar seu servidor Apache!

Faça isso para instalar:

  1. Abra uma janela de terminal.
  2. Digite wget http://www.diax.ch/users/liyanage/software/macosx/libphp4.so.gz , e espere o download terminar.
  3. Digite gunzip libphp4.so.gz .
  4. Digite sudo apxs -i -a -n php4 libphp4.so
  5. Agora digite sudo open -a TextEdit /etc/httpd/httpd.conf . TextEdit abrirá o arquivo de configuração do servidor web. Localize Locate essas duas linhas perto do final do arquivo: (Use o comando Localizar (Find))

    #AddType application/x-httpd-php .php 
    #AddType application/x-httpd-php-source .phps
    
    Remove os caracteres de comentários (#), e depois salve o arquivo e saia do TextEdit.

  6. Finalmente, digite sudo apachectl graceful e reinicie o servidor web.

PHP deve estar funcionando. Você pode testar colocando um arquivo no seu diretório Sites chamado test.php. No arquivo, escreva essa linha: <?php phpinfo() ?>.

Agora abra 127.0.0.1/~your_username/test.php no seu navegador. Você deve ver uma tabela de status com informação sobre o módulo PHP.



User Contributed Notes
Compilando para o MacOS X - Versão Cliente
mdoyle at cooperationireland dot org
07-Apr-2008 11: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 04:54
if `wget` isn't installed or not in your path use `curl -O` instead.