# vi /etc/apache2/httpd.conf
In /etc/apache2/httpd.conf, uncomment this line:
LoadModule php5_module libexec/apache2/libphp5.so
# sudo apachectl restart
Create /etc/php.ini and make it writable
# cd /etc
# sudo cp php.ini.default php.ini
# sudo chmod 444 php.ini
Uncomment it and insert your time zone (http://php.net/manual/en/timezones.php)
date.timezone = America/Vancouver
Restart Apache
sudo apachectl restart
MySQL
Download the MySQL package for Mac OS X.5 (32 or 64 bits depending on your machine)
Install everything in the package in this order: mysql, the startup item, the preference pane.
Start MySQL in the preference pane.
Test it's working:
# /usr/local/mysql/bin/mysql
Fix mysql.sock location in php.ini
In /etc/php.ini, replace the three occurences of /var/mysql/mysql.sock by /tmp/mysql.sock:
pdo_mysql.default_socket=/tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
Restart Apache
# sudo apachectl restart
# cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
===
Extra
Activate PHP short tags
In /etc/php.ini, under Language Options, change
short_open_tag = Off
to
short_open_tag = On
Restart Apache
# sudo apachectl restart
===
APC (Alternative PHP Cache)
instal pcre first
// Download the new software.
curl -O http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.12%2F&ts=1314943607&use_mirror=voxel
// Uncompress it.
# tar zxvf pcre-8.01.tar.gz
// Go into the new directory.
# cd pcre-8.01
// Prepares for compiling?
# ./configure --prefix=/usr/local
# make
# make install
alternative method to use pcre, We can install that with Homebrew:
# brew install pcre
Now we start installing APC:
# pecl install apc
# vi /etc/php.ini
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/apc.so
extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=32M
apc.cache_by_default=1
apc.stat=1
;; For Drupal upload progress.
;apc.rfc1867=1
;; 2 hours
;apc.stat=7200
So to summarize, here’s what I did:
# sudo pear update-channels
# brew install pcre
# sudo pecl install apc-3.1.6
Reference:
http://maestric.com/doc/mac/apache_php_mysql_snow_leopard
http://i.justrealized.com/2010/install-php-apc-mac-os/
http://www.gigoblog.com/2011/01/23/install_memcache_and_apc_on_mac_os_x_server/
Saturday, October 1, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment