Install and configure Apache, PHP, and MySQL with homebrew under Mac

Source: Internet
Author: User
Tags apache php php mysql brew cask
Install and configure Apache, PHP, and MySQL with homebrew under Title:mac
DATE:2015/03/22 20:07:00

Tags:homebrew

We use the PHP runtime environment always like to use the integration package, in fact, under the Mac, with homebrew can also quickly install these things, configuration is very simple.

Homebrew

Homebrew is a Package installation management tool under Mac, which is very simple and convenient to use.

Installing homebrew

Execute in Terminal:

Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"

This will install the homebrew.

Installing the command-line software

If wget is installed, execute:

Brew Install wget

Other specific methods of use can be self-browsing the official website (Chinese).

Install Apache PHP mysql

Because Apache and PHP are not in the default repositories, we need to add the repositories that they are in.

Brew Tap Homebrew/apachebrew Tap homebrew/php

After the installation is normal, the installation process homebrew will handle all kinds of dependencies for you.

Brew Install httpd24brew install php53brew install MySQL

Note: Apache's name is httpd in homebrew.
These can be specified for the installed version, here I install Apache2.4,php5.3,mysql is the latest edition.
The following path descriptions are based on this and should be changed to the version you downloaded yourself.

Configure Apache

The configuration file path is/usr/local/etc/apache2/2.4/httpd.conf, and the following configuration needs to be modified in the appropriate location.

Add PHP Module
# ====php Module====loadmodule php5_module/usr/local/cellar/php53/5.3.29/libexec/apache2/libphp5.so
 
  
   
      AddType application/x-httpd-php. php    addtype application/x-httpd-php-source. Phps    
  
   
    
           directoryindex index.html index.php    
  
   
 
  
Modify the Listening port
The default port is 8080, we change to 80:
Listen 80
To modify the root root directory
DocumentRoot "/users/lonewolf/public/dev/php/app"
 
  

Please make your own changes to your directory

Configure MySQL

Using the default MySQL configuration will take up 434M of memory, which takes up too much, so modify it.
The configuration path is/usr/local/cellar/mysql/5.6.23/my.cnf.

# ========skip-external-lockingkey_buffer = 16mmax_allowed_packet = 1mtable_open_cache = 64sort_buffer_size = 512Knet_ Buffer_length = 8kread_buffer_size = 256kread_rnd_buffer_size = 512kmyisam_sort_buffer_size = 8M# ========

This starts and then drops below 100M .

Here, our installation and configuration is complete, but one thing is very bad, is to start and stop these services need to be entered at the command line, there is no graphical management interface?
Yes, the answer is Launchrocket, before we get to know another tool homebrew-cask.

Homebrew-cask

Homebrew-cask is an extension of homebrew for installing GUI Mac programs such as Google Chrome, QQ, and more.

Installation
Brew Install Caskroom/cask/brew-cask
Use
Brew Cask Install Google-chrome

Please check the official website for specific functions.

Launchrocket

Launchrocket is a manager that manages the apps installed by homebrew in the system settings .
installation command:

Brew Cask Install Launchrocket

The interface is as follows:

I do not know why, httpd need to choose as root to really run up.

All aspects of installation, configuration and operation have been completed.

Other tools

Finally, two useful tools are introduced:

1, Cakebrew

Cakebrew is a software for graphical management homebrew that allows you to install software without knocking commands.

2, Adminer

Adminer is a database management tool written in PHP, can manage MySQL, PostgreSQL, SQLite, MS SQL, Oracle, MongoDB and other types of database, but also a single file , installation and deployment is very convenient, Multiple languages are supported.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.