Thursday, July 7, 2011

PHP5 on OSX 10.6

Beginning steps:

copy /etc/php.ini.default to /etc/php.ini

edit/set the time zone in the php.ini file.

enable OSX web sharing (turns on apache2)

follow the yii guide installation instructions (pdf in the -docs package)

install yiiframework somewhere in ~/Sites

instructions to compile a compatible libmcrypt into the stock apache2:
http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/

visit
  http://127.0.0.1/~username/yii/requirements/index.php
profit!


update: we might just want to recompile:

http://www.malisphoto.com/tips/php-on-os-x.html ::
These installation instructions will compile PHP with a configuration that closely matches the PHP configuration shipped with OS X, but with the addition of enabling GD, PDO and MCRYPT support.
but we wound up not using these explicit instructions, and macports just worked.

apple's php534 was configured with:

'/var/tmp/apache_mod_php/apache_mod_php-53.4~2/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--sysconfdir=/private/etc' '--with-apxs2=/usr/sbin/apxs' '--enable-cli' '--with-config-file-path=/etc' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--with-curl=/usr' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-53.4~2/Root/usr/local' '--with-png-dir=/BinaryCache/apache_mod_php/apache_mod_php-53.4~2/Root/usr/local' '--enable-gd-native-ttf' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-iodbc=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--enable-zend-multibyte' '--enable-zip' '--with-pcre-regex=/usr'


except -- at this point -- it would seem silly to try and recompile an "apple-like" php5


why not just use macports:


http://stackoverflow.com/questions/3484306/setting-up-postgresql-to-work-with-my-local-dev
and
http://laurii.info/2010/08/macports-berkley-db-4-problem-and-work-around/


which had the command:

sudo port install apache2 postgresql83 php+postgresql83+mysql5+pear+apache2
but didn't work exactly -- we found out later.

and with only a tiny bit of cruft (need to add local machine name to /etc/hosts as a loopback ip)
http://old.nabble.com/Localhost-down-%7C-MacPorts-LAMP-td27733679.html

using instructions at http://www.mkbernier.com/2010/09/28/installing-macports-php-mysql-pear-and-phpunit-on-mac-osx-snow-leopard/

we recompiled php5 with additional flags, and followed their config changes.

sudo port install php5 +apache2


sudo port install php5-sqlite php5-gd php5-mcrypt


fairly good looking success now:

Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/1.0.0d DAV/2 PHP/5.3.6 Yii Framework/1.1.8 2011-07-07 05:46

No comments:

Post a Comment

#RSFtalks with Edward Snowden

What an intelligent, thoughtful individual. I find it difficult to forgive 44 for failing to pardon this patriot and instead pursuing him ...

Other Popular Posts: