Install apache+php+mysql+memcached Environment notes under Mac Yosemite

Source: Internet
Author: User
Tags apache php mcrypt memcached redis zend install redis automake

In order to install convenient, need to pay attention to a few small details.
It is best to install the Xcode before installing this environment
Mac OS X 10.10 Yosemite with PHP5.5 and Apache2.4 make the appropriate changes.
Mac installs the required tools first
Download of Macport: http://www.macports.org/
Download and install port, if the terminal is open, remember to exit the terminal after the installation is completed yo
Install the GNU Autotools:
Several files are required to install Autotools
Automake
Autoconf
M4
The order of installation is M4-> autoconf-> automake (IMPORTANT!!!! )
Perform the following command to install:
sudo port install M4
sudo port install autoconf
sudo port install Automake
After executing the above command, the following 5 tools are installed:
The GNU Autotools refers to the following five tools:
(1) aclocal
(2) AutoScan
(3) autoconf
(4) Autoheader
(5) Automake
Apache PHP Configuration Chapter
Apache Configuration directory/etc/apache2
Some configuration modifications to Apache and PHP
The Apache system-level root directory and its corresponding URLs are:
/library/webserver/documents/
http://localhost
Create a Site Directory
sudo mkdir ~/sites
Create a profile username for your username
sudo vi/etc/apache2/users/username.conf
After it is created, write the following lines to the Conf file above:
<directory "/users/username/sites/" >
Options Indexes MultiViews
AllowOverride All
Order Allow,deny
Allow from all
</Directory>
After the file is saved, give it the appropriate permissions:
sudo chmod 755/etc/apache2/users/username.conf
Modify httpd.conf Primary Configuration related
sudo vi/etc/apache2/httpd.conf
Remove comments
LoadModule Php5_module libexec/apache2/libphp5.so

LoadModule Authz_core_module libexec/apache2/mod_authz_core.so
LoadModule Authz_host_module libexec/apache2/mod_authz_host.so
LoadModule Userdir_module libexec/apache2/mod_userdir.so
Include/private/etc/apache2/extra/httpd-userdir.conf
Modify/etc/apache2/extra/httpd-userdir.conf
sudo vim/etc/apache2/extra/httpd-userdir.conf
Find the following information to fix and remove the # in front of it:
Include/private/etc/apache2/users/*.conf
Copy/etc/php.ini.default to/etc/php.ini, using the command:
Cp/etc/php.ini.default/etc/php.ini
Next, restart Apache so that the profile takes effect:
sudo apachectl restart
Browser Open http://localhost Http://localhost/~username
It's already OK in theory!
PHP extensions
Installing the PHP extension requires your Mac system to have the Xcode environment and command-line development tools installed and, if not already installed, use shell installation first. [I do not know why to install this! If you don't want to pretend, you can try it.
Xcode-select--install
To extend administrative convenience, first install the PECL Extension Manager.
cd/usr/lib/php
sudo php Install-pear-nozlib.phar
Install Redis, Memcache, MONGO and other extensions.
sudo pecl install Redis
sudo pecl install Memcache
sudo pecl install MONGO
sudo pecl install Xdebug
To add an extended configuration to the php.ini file:
Extension=memcache.so
Extension=mongo.so
Extension=redis.so
Zend_extension=xdebug.so
Since the Mac's own PHP environment does not include MCrypt extensions, it is necessary to download the same version of the PHP source package and compile this module separately. From the official website of the archive to find php5.5.14 source package, download: http://php.net/releases/
Install a component first Libmcrypt
Curl-o http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
Tar zxvf libmcrypt-2.5.8.tar.gz
CD libmcrypt-2.5.8
./configure
Make
sudo make install
Re-install MCrypt extension
Tar zxvf php-5.5.14.tar.gz
CD php-5.5.14/ext/mcrypt/
Phpize
./configure
Make
sudo make install
Configure Ext-mcrypt
Extension=mcrypt.so
Some of the other common extensions use
Speed up, open Opcache
Zend_extension=opcache.so
[Opcache]
; Determines if Zend Opcache is enabled
Opcache.enable=0

; Determines if Zend Opcache is enabled for the CLI version of PHP
Opcache.enable_cli=0
Install XCache, download http://xcache.lighttpd.net/wiki/Release-3.2.0 from official website
Unzip and install
Tar xvf Xcache-3.2.0.tar
CD xcache-3.2.0
Phpize
./configure
Make
sudo make install
Configure XCache
[XCache]
Xcache.size = 128M
Xcache.var_size = 8M
Xcache.var_count = 1
Xcache.var_slots = 8K
Xcache.var_ttl = 0
Xcache.var_maxttl = 0
Xcache.var_gc_interval = 300
Xcache.optimizer = Off
Install memcached
sudo port install memcached
Start
sudo memcached-p 11211-m 64-u root-d
installing MySQL
Website Download MySQL installation package http://dev.mysql.com/downloads/mysql/
Download DMG Archive
If you need to login/register, directly below the point: No, just start my download.
Download complete, double-click install.
Open MySQL by command:
Sudo/usr/local/mysql/support-files/mysql.server start
Set Root user password
/usr/local/mysql/bin/mysqladmin-u root password ' here fill in the password you want to set '
Connect terminals, login MySQL
/usr/local/mysql/bin/mysql-u root-p
Execute order STATUS; Write down the value of the UNIX socket my local default/tmp/mysql.sock
Edit related extension parameters in php.ini
Mysql.default_socket
Mysqli.default_socket
Pdo_mysql.default_socket

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.