LNMP Environment Multi-version PHP coexistence

Source: Internet
Author: User

This is because bloggers encountered a problem with the pit daddy when they deployed the new site.

The server already has the environment: LNMP, also has the website to run, this is php5.5

The pit daddy is, there is a new website to deploy, according to Convention, add server in nginx.conf, restart Nginx but find new website can't run up

View Error_log [ERROR] 18850#0: *2956 directory Index of "/data/web/***/upload/" is forbidden

So Bo Master on a variety of search, all kinds of test, the results are not, Bo master at that time, also too pit Dad, so with the customer to discuss "otherwise we redo system?" Re-deploy the environment? "The customer said," I have a server on the * * * * * * *, you have to give me reload on. Yes, this is your uncle's I know what you run a thing (Bo Master is technical small white).

So local set up an environment, the customer's old website deployed to the local test, the result, hehe, did not run up, so Bo Master is a pass to swish, debugging a pass, did not make a why. Bo Master on the customer said, I am not fine, you still somebody else it!!! Who Chengxiang, this goods through means to find the leader, the leader said, "* * *, this customer by **1, **2, assist to deal with", this does not pit dad, those two buddies are not hands of the Lord, live and hit my hand, then the small leader asked "what environment", I "Lnmp", "php What version", " PHP5.5 "," our website php5.5 can not run, to him to deploy multiple versions of PHP coexistence bar ", I" ... "That's rude awakening, clairvoyant. Baby's heart is bitter, the baby will not. But the goose, Bo Master thought of the next, into.

The end of The Spit Groove

Text Start ...

The new site needs to be php5.2 or 5.3

php5.5 and MySQL are compiled and installed, the path is in the/usr/local directory, if the installation of Yum is installed in the/etc directory, so the scheme is feasible

Yum Install PHP-FPM, version is 5.3, but if the PHP-FPM default port is 9000, there is already a php-fpm running, if you want to run another, then the new installation of PHP-FPM will need to modify the lower port

Vim/etc/php-fpm.d/***.conf

Listen = 127.0.0.1:9000 revision changed to

Listen = 127.0.0.1:9001

: Wq

Service PHP-FPM Restart Restart the newly installed PHP-FPM (the original PHP-FPM does not have this command, so do not worry about conflicts)

Do a probe to check the environment.

In the new Site Directory

Vim test.php

<?php

Phpinfo ();

?>

: Wq

The browser opens this file, which displays as follows:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8C/B4/wKioL1h1kB2CSZ1VAAAhrBAKS54637.jpg-wh_500x0-wm_ 3-wmp_4-s_4054803062.jpg "title=" qq picture 20170111095315.jpg "alt=" Wkiol1h1kb2csz1vaaahrbaks54637.jpg-wh_50 "/>

Description PHP installed correctly

But the website still can't open,/etc/php.ini in Short_open_tag = 0 Restart php-fpm still can't open

NETSTAT-NTPL viewing PHP-FPM operating properly

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8C/B7/wKiom1h1ke_Q0f_5AAAk1IC2MJo644.jpg-wh_500x0-wm_ 3-wmp_4-s_3143755750.jpg "title=" qq picture 20170111100115.jpg "alt=" Wkiom1h1ke_q0f_5aaak1ic2mjo644.jpg-wh_50 "/>

Check the probe and found no MySQL, stating that the newly installed PHP-FPM did not communicate with MySQL

Check for any packages that are not installed?

Installing only one php-fpm is definitely not going to work, so install some more related packages.

Yum install php-mysql php-mbstring php-mcrypt php-pdo

Installation Complete reboot PHP-FPM

Website still can't open, probe inside a word without MySQL, baby heart good catch urgent

The newly installed PHP-FPM is still not able to communicate with MySQL

Vim/etc/php.ini

...

[MySQL]

...

Mysql.default_socket = revision changed to

Mysql.default_socket =/tmp/mysql.sock

: Wq

Restart PHP-FPM

The website will open normally!!!

Summary, this problem troubled a few days, finally done! 1, the method is more than difficult, 2, you need to have a language to wake up the dream of people, 3, the work is not good will be deducted wages

The above ignores the MySQL related content, the database configuration, the database import and so on,

The contents of the nginx.conf are also attached.

Note: Fastcgi_pass in the first server differs from the second and third ports, the first one is php-fpm5.5, and the second to third is php-fpm5.3.

The environment does not make special changes, the customer's things can be less moving, less moving


#user www; # # Default:nobody

Worker_processes 1; # # Default:1


Error_log Logs/error.log;

Error_log Logs/error.log Notice;

Error_log Logs/error.log Info;


PID Logs/nginx.pid;

Worker_rlimit_nofile 8192;


Events {

Worker_connections 4096; # # default:1024

}


HTTP {

Include Mime.types;

Default_type Application/octet-stream;

Access_log off;

Sendfile on;

Keepalive_timeout 65;

Server_tokens off;

Fastcgi_intercept_errors on;

Client_header_timeout 10;

Client_body_timeout 10;

Reset_timedout_connection on;

Send_timeout 10;

Client_header_buffer_size 32k;

Large_client_header_buffers 1 128k;

Client_max_body_size 8m;

gzip on;

Gzip_buffers 4k;

Gzip_comp_level 9;

Gzip_http_version 1.1;

Gzip_min_length 1k;

Gzip_proxied expired No-cache No-store private auth;

Gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image /jpeg image/gif image/png image/jpg;

Gzip_vary on;

Gzip_disable "MSIE [1-6]\.";

Log_format wwwlogs ' $remote _addr $upstream _addr--$time _iso8601 "$request _method $scheme://$host $request_uri $server _ Protocol "$request _time $upstream _response_time $status $upstream _status $bytes _sent $body _bytes_sent" $http _referer " "$http _user_agent" $upstream _cache_status:tcp ';


#################################################################################


Index index.html index.php default.php index.htm;

server {

Listen 80;

root/data/***/***1;

Error_page 404/404.html;

server_name ***1.com;

Location/{

Allow all;

Try_files $uri $uri//index.php/$request _uri;

}

Location ~ (index)? \.php ($|/) {

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Include Fastcgi_params;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Fastcgi_param path_info $fastcgi _path_info;

Fastcgi_param path_translated $document _root$fastcgi_path_info;

}

}

#################################################################################


Index index.html index.php default.php index.htm;

server {

Listen 80;

root/data/***/***2;

Error_page 404/404.html;

server_name ***2.com;

# location/{

# Allow all;

# try_files $uri $uri//index.php/$request _uri;

#    }

# location ~ (index)? \.php ($|/) {


Location =/favicon.ico {

Log_not_found off;

Access_log off;

}


Location ~ \.php$ {

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

Fastcgi_pass 127.0.0.1:9001;

Fastcgi_index index.php;

Include Fastcgi_params;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

# Fastcgi_param Path_info $fastcgi _path_info;

# Fastcgi_param path_translated $document _root$fastcgi_path_info;

}

}

#################################################################################

Index index.html index.php default.php index.htm;

server {

Listen 80;

root/data/***/***3;

Error_page 404/404.html;

server_name ***3.com;

# location/{

# Allow all;

# try_files $uri $uri//index.php/$request _uri;

# try_files $uri/index.php;

#    }

Location =/favicon.ico {

Log_not_found off;

Access_log off;

}


Location ~ \.php$ {

# location ~ (index)? \.php ($|/) {

Fastcgi_split_path_info ^ (. +\.php) (/.+) $;

Fastcgi_pass 127.0.0.1:9001;

Fastcgi_index index.php;

Include Fastcgi_params;

# Fastcgi_param Script_filename $document _root$fastcgi_script_name;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

# Fastcgi_param Path_info $fastcgi _path_info;

# Fastcgi_param path_translated $document _root$fastcgi_path_info;

}

}

#################################################################################


}




This article is from the "Wszzdanm" blog, make sure to keep this source http://wszzdanm.blog.51cto.com/1841747/1890994

LNMP Environment Multi-version PHP coexistence

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.