Mac builds PHP development environment (mac+apache+mysql+php) and installs Zend FRAMEWORK1 framework

Source: Internet
Author: User
Tags install brew pear php cli php development environment zend zend framework

My Computer environment: Mac 10.09

First, the Mac computer comes with Apache, it is not happy to reinstall the

Simple, three commands for Apache.

sudo apachectl start open

sudo apachectl restart restart

sudo apachectl stop stop

To view the version of native Apache:

sudo apachectl-v

The path to the Apache configuration file is:

/etc/apache2/httpd.conf

Here I did not use the Apache default site but instead changed it to a new folder under my user directory

Mkdir/users/liupeng/sites

I'm going to use the folder as a place to put the PHP program later, and then we need to change the Apache configuration so that it supports

sudo vim/etc/apache2/httpd.conf

The main is to change the path of the DocumentRoot, save and then exit restart Apache, your configuration is successful

You can output a new PHP file output to do a test in this directory

Apache configuration first here, we'll have to set it up again.

Second, the PHP Mac system comes with 5.4 of the version, I need to use 5.3, I decided to use brew to install, this is similar to Ubuntu under the Apt-get management tool, mainly to help install the related dependent class library

We start by installing brew

You can refer directly to the official documentation: Install Brew

After the installation is complete, we follow the steps below to install the php5.3 version

 brew update brew tap homebrew/dupes brew tap josegonzalez/homebrew-php # brew install php55  如果想安装5.5版本就用这个命令 brew install php53
如果安装过程中出现问题,建议直接谷歌,或者直接去github上面的brew主页寻找帮助,我遇到的问题就是在上面看到外国人发的问题的答案里解决掉的。

安装完成后默认的安装位置是
这个时候看好终端输出,它会教你怎么去使apache加载这个版本的php,大家可以看下我的,我把原有的注释掉了
sudo vim /etc/apache2/httpd.conf

Edit and save the exit, restart Apache, just fine!

This time also involves an environment variable problem, if we enter in the terminal php-v may display or the original system PHP version information, we follow the instructions in the terminal, directly copy and paste execution is possible! Attach my terminal information

To enable PHP on Apache add the following to httpd.conf and restart Apache:

LoadModule php5_module/usr/local/opt/php53/libexec/apache2/libphp5.so

The php.ini file can is found in:

/usr/local/etc/php/5.3/php.ini

???? PEAR????

If PEAR complains about permissions, ' fix ' The default PEAR permissions and config:

Chmod-r ug+w/usr/local/cellar/php53/5.3.29/lib/php

Pear Config-set Php_ini/usr/local/etc/php/5.3/php.ini System

???? Extensions????

If you have a issues with a custom extension compiling, ensure that

You is using the brew version, by Placing/usr/local/bin Before/usr/sbin in your PATH:

Path= "/usr/local/bin: $PATH"

PHP53 Extensions'll always be compiled against this PHP. Please install them

Using--without-homebrew-php to enable compiling against system PHP.

???? PHP CLI????

If you wish-to-swap the PHP you use on the command line, you should add the following to ~/.BASHRC,

~/.ZSHRC, ~/.profile or your shell ' s equivalent configuration file:

Export Path= "$ (Brew--prefix homebrew/php/php53)/bin: $PATH"

To has launchd start php53 at login:

Ln-sfv/usr/local/opt/php53/*.plist ~/library/launchagents

Then-to-load php53 now:

Launchctl Load ~/library/launchagents/homebrew.mxcl.php53.plist

Third, as for the installation of MySQL, this side I will not say, we go to Baidu to see it!

Four, the next start to install Zend Framework1 configuration

First, we need to download the full Zip package, after the download has been done to extract the need to

The Zend folder below this directory is copied to the directory path of PHP include_path

This specific path is found in Phpinfo itself, where we use the ZF tool to create the project folder

We need to move the two files in the bin folder below the zf.sh zf.php to/usr/bin, where we also need to create environment variables

We refer to this article:

Let's switch to/users/liupeng/sites under this directory

ZF Create Project Zendframework

The project folder is automatically generated in this directory.

In the final step, we set up a virtual host:

First, open the virtual host configuration in the Apache configuration file:

Remove the comments in front of the statement, turn on the load virtual host configuration, and then go to the virtual host configuration file to set up

sudo vim/etc/apache2/extra/httpd-vhosts.conf, below everyone can refer to my configuration, note I tick the place, this is the main entrance of the Zend Framework frame, do not write wrong

Here everyone should pay attention to open Rwrite rewrite module, in the httpd.conf inside open the relevant module (is to remove the previous comment number)

Attention should also be opened in the directory, that is the few statements, be sure to pay attention to.

All right, let's talk about this. I'm going to take a good look at the problem of environment variables. Not clear you can leave a message or send me an e-mail, we discuss together! Previously encountered problems always like to escape, all kinds of Baidu Google, or calm down to their own thinking and then find a solution is the kingly way

This article is only for your future reference and write, toss two genius to fix. Encounter some problems on the crazy looking for Google Baidu, finally found to be good to see the terminal back to you the information, in fact, there has been a solution to the answer, the biggest problem is not thin enough of their own heart.

This article mainly refer to Baidu Google's information, as well as Yansu's blog

Mac builds PHP development environment (mac+apache+mysql+php) and installs Zend FRAMEWORK1 framework

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.