Under Ubuntu Build the PHP Development environment (nginx+ (CGI) php5fpm+memcached+xdebug) _linux

Source: Internet
Author: User

Because it's just a development environment, it's all about choosing a simpler apt-get installation, but there's a problem in the middle.

First install Nginx

Nginx installation and configuration is actually very simple, nginx itself is very lightweight,

The direct sudo apt-get install nginx is OK

His profile is in the/etc/nginx/, the website project path is inside/var/www, after installation must ensure that Nginx's startup account has access to the site directory, otherwise it will be an error.

Step two, install the CGI

Linux under the CGI program is very much, here I choose php5-fpm convenient here is actually a pit, a lot of information on the Internet that the default after the installation of CGI port is 9000, I have a mistake here.

After installation, add a CGI forwarding configuration to the Nginx servers

Copy Code code as follows:

Location ~. *\.php?$
{
Include Fastcgi_params;
Fastcgi_pass Unix:/var/run/php5-fpm.sock;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
}

The red place is to be noted, and the other information on the Internet is also different

Once you've saved it, it's better to load the Nginx configuration.

Copy Code code as follows:

sudo php5-fpm stop;

sudo php5-fpm start;

sudo service nginx reload;

After a few steps, you can basically make sure that running PHP is fine.

Then install memcached

Copy Code code as follows:

sudo apt-get install memcached

After installing the Memcache server, we need to start the service:

Copy Code code as follows:

Memcached-d-M 128-p 11111-u Root

Xdebug Installation

Copy Code code as follows:

sudo apt-get install Php5-dev php5-cli
#其中php5-dev must be installed in order to install Xdebug.

sudo apt-get install php5-xsl
#Xinc需要xsl extension

sudo apt-get install Php-pear
The #pecl install must

sudo pecl install Xdebug
#安装xdebug, the installation completes when the compilation succeeds

And then add it to the PHP configuration item

Copy Code code as follows:

Zend_extension=xdebug.so

And then

Copy Code code as follows:

sudo php5-fpm stop;

sudo php5-fpm start;

You can see the Xdebug option in Phpinfo ().

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.