Linux Installation Development Tools

Source: Internet
Author: User
Tags fpm php session

In the study of Linux on the journey, encountered a variety of problems, has been resolved to take notes

Key installation

[more detailed explanation from]lnmp.org pages

Installing the LNMP stable version
Wget-c http://soft.vpser.net/lnmp/lnmp1.3-full.tar.gz && tar zxf lnmp1.3-full.tar.gz && CD Lnmp1.3-full &&/install.sh Lnmp

For more details, see lnmp.org.

Installing a cache such as Redis

Please look at https://lnmp.org/faq/addons.html.

Two Yum installations [learn http://blog.chinaunix.net/uid-26744202-id-5746873.html]


1, install EPEL source EPEL Source as a supplement to the official CentOS source, inside are some basic packages (Https://fedoraproject.org/wiki/EPEL official website)


    1. RPM-UVH http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm



2, install Remi Source, Remi Source is almost all the latest stable version, are the Linux Bone Maintenance update (http://rpms.famillecollet.com/official website)


    1. RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


3, start installing PHP,

    1. =============================================================================================================== ======== N/S matched:php-fpm ==================================================================================== ====================================
    2. php-fpm.x86_64:php FastCGI Process Manager
    3. php56-php-fpm.x86_64:php FastCGI Process Manager
    4. php70-php-fpm.x86_64:php FastCGI Process Manager
    5. php71-php-fpm.x86_64:php FastCGI Process Manager


PHP-FPM defaults to 5.3, which is recommended to install PHP56

    1. Yum install--enablerepo=remi php56-php-fpm php56-php-mysqld Php56-php-redis

Optional installation of Php56-eaccelerator, or PHP-PECL-APC, and OPCAHCE are all PHP accelerators.

Yum install--enablerepo=remi php56-php-pear php56-php-devel Php56-php-opcache


    1. Chkconfig--level 2345 PHP56-PHP-FPM on


Start PHP-FPM

    1. Service PHP56-PHP-FPM Restart

4, install MySQL


    1. yum-y--enablerepo=remi install MySQL Mysql-server

    1. Chkconfig--level 2345 mysqld on

    1. Service mysqld Start

Start setting up mysqld with the Mysql_secure_installation command, and then modify the MySQL profile path as you like mysql_install_db--defaults-file=/etc/my.cnf (// View MySQL Boot profile Ps-ef | grep mysqld)
Ps:

Default MySQL password is empty press ENTER directly
6. Install and run Redis

    1. Yum Install--enablerepo=remi Redis

    2. Service Redis Start

7, install Nginx

Click ( here) to collapse or open

    1. Yum Install Nginx
    2. Service Nginx Start


Modify PHP Session Save method

Vim/opt/remi/php56/root/etc/php-fpm.d/www.conf


Find Session Modification
Php_value[session.save_handler] = Redis
Php_value[session.save_path] = "tcp://127.0.0.1:6379"




Finally shut down the firewall
/etc/init.d/iptables stop

If you encounter the session cannot save the situation, please check the session to save the directory
#建立session保存目录
Mkdir/var/lib/php/session
Chmod-r 777/var/lib/php/session

I was having trouble installing MySQL.

  • File/usr/share/mysql/italian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/japanese/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/korean/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with file From Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts With file from the package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/norwegian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/polish/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with file From Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/portuguese/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/romanian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/russian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/serbian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/slovak/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with file From Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/spanish/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/swedish/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
  • File/usr/share/mysql/ukrainian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686

Error Summary reason is packet conflict

The solution is to erase all the packages.

Yum Remove mysql-libs-5.1.52*

Remove and install again

After installing various environments, the second step is to let Nginx support PHP
Find the default.conf under the Nginx.


    1. # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    2. #
    3. #location ~ \.php$ {
    4. # root HTML;
    5. # Fastcgi_pass 127.0.0.1:9000;
    6. # Fastcgi_index index.php;
    7. # Fastcgi_param Script_filename/scripts$fastcgi_script_name;
    8. # include Fastcgi_params;
    9. #}

Because Nginx is not associated with PHP by default, so here
The revision was changed to

      1. Location ~ \.php$ {
      2. root/usr/share/nginx/html;
      3. Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
      4. Fastcgi_pass 127.0.0.1:9000;
      5. Fastcgi_index index.php;
      6. Try_files $uri = 403;
      7. Fastcgi_param script_filename $request _filename;
      8. Include Fastcgi_params;
      9. }


Then, all the files will be parsed with the default index.php, in order to prioritize the resolution of that kind of file


    1. Location/{
    2. root/usr/share/nginx/html;
    3. Index index.html index.htm;
    4. }

Revision changed to


    1. Location/{
    2. root/usr/share/nginx/html;
    3. Index index.php index.html index.htm;
    4. }


This way, Nginx can parse the PHP file.


In addition, this can be combined with the socket to perform PHP-FPM to optimize the speed, in the specific way
Find php-fpm.d/www.conf and modify the

    1. Listen = 127.0.0.1:9000


Change it to

    1. Listen =/tmp/php-fcgi.sock

Also pay attention to the permissions problem, the default mode is 0660 restart PHP-FPM will not be able to read fcgi need to change to 0666

; Listen.owner = php-fpm
; listen.group = php-fpm
Listen.mode = 0666



And then in Nginx parsing PHP modified Fastcgi_pass execution mode for the socket

    1. Location ~ \.php$ {
    2. root/usr/share/nginx/html;
    3. Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
    4. Fastcgi_pass Unix:/tmp/php-fcgi.sock;
    5. Fastcgi_index index.php;
    6. Try_files $uri = 403;
    7. Fastcgi_param script_filename $request _filename;
    8. Include Fastcgi_params;
    9. }

So the PHP-FPM is executed in socket mode.

Upload file size
Vim/etc/nginx/nginx.conf
Client_max_body_size 10M;

Linux Installation Development Tools

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.