Build a Web server development environment for Apache, PHP, and MySQL on Mac OS x.
Tools/Materials
- Mac OS X 10.10
- Homebrew Software
Method/Step
1. How do I turn on Apache server?
There are two ways to open a Web server:
One is: Open Web share (web sharing), "System Preferences (Preferences)", "Sharing (sharing)".
Another: Open by running Apache's start command directly on the terminal terminal: sudo apachectl start.
I did not find the Web sharing on my Mac OS X 10.9.5, so I can only open the server in the second way.
Apache server Default Web root directory in:/library/webserver/documents.
Apache configuration file in:/etc/apache2.
2. Open the PHP module
Because Mac OS X has built-in PHP, we just need to load the PHP module in Apache's configuration. Methods such as:
1) run at Terminal: sudo vi/etc/apache2/httpd.conf, open Apache config file.
2) Find #loadmodule Php5_module libexec/apache2/libphp5.so Similar entry, remove the note #, and save it.
3) terminal run: sudo apachectl restart, restart Apache server.
3. Install and start MySQL
1) Install MySQL using homebrew:
Install the software on Mac OS X, you can directly find the relevant IMG installation, can also be like Ubuntu apt-get similar convenience, can use the brew install.
Of course, using this feature, you need to install homebrew, the installation method is:
Run command at Terminal: RUBY-E "$ (Curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)".
Install MySQL, run at Terminal: Brew install MySQL.
The BREW program will automatically install the MySQL dependent Library OpenSSL and then install MySQL, which I installed is: mysql-5.6.2.
2) Start MySQL:
Based on the instructions above, start MySQL, run at Terminal: Mysql.server start. After successful startup, use: Mysql-uroot to connect to MySQL database.
END
Build Apache, PHP, and MySQL Web servers on Mac OS x