Install and configure apache, php, and mysql with homebrew on MAC

Source: Internet
Author: User
Tags apache php install homebrew php mysql brew cask
Install and configure apache, php, and mysql with homebrew on MAC title: install and configure apache, php, and mysql with homebrew on MAC
Date: 20:07:00

Tags: homebrew

When we use the php runtime environment, we always like to use integration packages. In fact, on mac, homebrew can be used to quickly install these items, and the configuration is also very simple.

Homebrew

Homebrew is a package installation and management tool in mac, which is very easy to use.

Install homebrew

Run the following command on the terminal:

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

In this way, homebrew is installed.

Install Command Line Software

If wget is installed, run the following command:

brew install wget

You can refer to the official website (Chinese) for other specific usage methods ).

Install apache php mysql

Because apache and php are not in the default repository, we need to add the repository where they are located first.

brew tap homebrew/apachebrew tap homebrew/php

After that, it will be installed normally. during the installation process, homebrew will handle various dependencies for you.

brew install httpd24brew install php53brew install mysql

Note: apache is named httpd in homebrew.
You can specify the version to install. here I install apache2.4, php5.3, and mysql is the latest version.
The following paths are based on thisModify the version you downloaded.

Configure apache

The path of the configuration file is/usr/local/etc/apache2/2.4/httpd. conf. the following configurations must be modified in the corresponding place.

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 listening port
The default port is 8080. we changed it to 80:
Listen 80
Modify root directory
DocumentRoot "/Users/lonewolf/Public/dev/php/app"
 

Modify your own directory

Configure mysql

When started with the default mysql configuration434 MMemory, which occupies too much, so you need to 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# ========

In this way, it will be dropped100 MBelow.

At this point, our installation and configuration have been completed, but it is very difficult to start and stop these services all need to be input under the command line. Is there a graphical management interface?
Yes, the answer is LaunchRocket. Before that, let's take a look at another tool homebrew-cask.

Homebrew-cask

Homebrew-cask is an extension of homebrew. it is used to install graphical mac programs, such as google chrome and QQ.

Install
brew install caskroom/cask/brew-cask
Use
brew cask install google-chrome

For specific functions, refer to the official website.

LaunchRocket

LaunchRocket is a manager for managing the applications installed by homebrew.System Settings.
Installation Command:

brew cask install launchrocket

The interface is as follows:

I don't know why, httpd needs to select As Root to really run.

At this point, installation, configuration, and operation are complete.

Other tools

Finally, we will introduce two useful tools:

1. cakebrew

Cakebrew is a software for graphical management of homebrew, that is, it allows you to install the software without having to knock on the command.

2. adminer

Adminer is written in php a database management tool, can manage MySQL, PostgreSQL, SQLite, ms SQL, Oracle, MongoDB and other types of databases, and stillSingle fileIt is easy to install and deploy and supports multiple languages.

Related Article

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.