日期:2014-05-17  浏览次数:20403 次

MAC Environment Setting Up(2)PHP environment
MAC Environment Setting Up(2)PHP environment
1. Check and Install Apache2
>sudo apachectl -v
Server version: Apache/2.2.22 (Unix)
Server built:   Jun 20 2012 13:57:09

My apache with version 2.2.22 is already there.
>sudo apachectl start
Visit the home page http://localhost. I can see the testing page.
The default web pages will be under this directory /Library/WebServer/Documents.

2. Check and Install PHP
In /etc/apache2/httpd.conf, uncomment this line:
LoadModule php5_module libexec/apache2/libphp5.so

Copy and prepare the PHP configuration files.
>sudo cp /etc/php.ini.default /etc/php.ini
We can change this configuration file as we like.

Prepare the testing page of PHP.
>sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php

Then we can visit the page http://localhost/info.php now.

3. KeePassX
http://www.keepassx.org/

4. Install MySQL
Download these installation files from here http://dev.mysql.com/downloads/mysql/5.1.html.
mysql-5.1.65-osx10.6-x86_64.dmg

After install this software, I got the mysql in this folder mysql-5.1.65-osx10.6-x86_64.

If we install MySQLStartupItem.pkg, then MySQL will start automatically when the PC start.

MySQL.prefPane is for the icon in system configuration.

>chmod 777 /etc/bashrc
>sudo vi /etc/bashrc
Add 3 lines at the bottom
#mysql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'

>. /etc/bashrc
>mysqladmin -u root password 'kaishi'
Set the root password of MySQL.

5. Install Coda
http://soft.macx.cn/2647.htm


references:
http://sillycat.iteye.com/blog/1543227
http://sillycat.iteye.com/blog/1286175
http://sillycat.iteye.com/blog/1073598
http://sillycat.iteye.com/blog/1040371

http://sillycat.iteye.com/blog/768664
http://sillycat.iteye.com/blog/769110
http://sillycat.iteye.com/blog/770369

http://maestric.com/doc/mac/apache_php_mysql_snow_leopard
http://dancewithnet.com/2010/05/09/run-apache-php-mysql-in-mac-os-x/