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

Source: Internet
Author: User
Tags apache php php mysql brew cask

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<IfModule mod_php5.c>    AddType application/x-httpd-php .php    AddType application/x-httpd-php-source .phps    <IfModule mod_dir.c>        DirectoryIndex index.html index.php    </IfModule></IfModule>
    • 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"<Directory "/Users/lonewolf/Public/dev/php/app">

Please make your own changes to your directory

Configure MySQL

The configuration path is /usr/local/Cellar/mysql/5.6.23/my.cnf .

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 say that, let's look at another tool homebrew-cask .

Homebrew-cask

Homebrew-cask is an extension of homebrew for installing graphical interface Mac programs such as google chrome , and QQ so on.

    • 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:

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.

Original link Address: http://lonewolf.name/blog/2015/03/22/homebrew-apache-php-mysql/

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

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.