CENTOS7 Configuring the NMP environment

Source: Internet
Author: User
Tags curl openssl gmp mcrypt

Nginx directly compiled installation can be placed under the/usr/local/nginx

The installation of PHP first adds dependent applications
Yum install-y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel LIBXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses Curl Openssl-devel gdb M-devel db4-devel libxpm-devel libx11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c Xmlrpc-c-devel Installing the Encryption extension Library download the Libmcrypt,mhash,mcrypt installation package
Libmcrypt (libmcrypt-2.5.8.tar.gz):
MCrypt (mcrypt-2.6.8.tar.gz):
Mhash (mhash-0.9.9.9.tar.gz):

2. Install Libmcrypt First


3. Installing Mhash
#tar-ZXVF mhash-0.9.9.9.tar.gz#cd Mhash-0.9.9.9#./configure#make#make Install

4. Installing MCrypt
#tar-zxvf mcrypt-2.6.8.tar.gz#cd mcrypt-2.6.8#ld_library_path=/usr/local/lib./configure#make#make Install
Tar zxvf php-5.6.3.tar.gz
Cd php-5.6.3 ./configure--prefix=/usr/local/php --with-mysql=/usr/local/mysql--with-mysql-sock- -with-mysqli=/usr/local/mysql/bin/mysql_config--enable-fpm--with-ncurses--enable-soap--with-libxml-dir-- With-xmlrpc--with-openssl--with-mcrypt--with-mhash--with-pcre-regex--with-sqlite3--with-zlib--enable-bcmath-- With-iconv--with-bz2--enable-calendar--with-curl--with-cdb--enable-dom--enable-exif--enable-fileinfo-- Enable-filter--with-pcre-dir--enable-ftp--with-gd--with-openssl-dir--with-jpeg-dir--with-png-dir-- With-zlib-dir--with-freetype-dir--enable-gd-native-ttf--enable-gd-jis-conv--with-gettext--with-gmp--with-mhash --enable-json--enable-mbstring--disable-mbregex--disable-mbregex-backtrack--WITH-LIBMBFL--with-onig-- Enable-pdo--with-pdo-mysql --with-zlib-dir--with-pdo-sqlite--with-readline--enable-session--enable-shmop- -enable-simplexml--enable-sockets--enable-sqlite-utf8--enable-sysvmsg--enable-sysvsem--ENABLE-SYSVSHM --ENABLE-WDDX--with-libxml-dir--with-xsl--enable-zip--enable-mysqlnd-compression-support--with-pear thenMake && do install Build complete.
Don ' t forget to run ' make test '.

Cp/usr/local/php/etc/php-fpm.conf.default php-fpm.conf
Duplicate a copy and rename it


/usr/local/php/sbin/php-fpm
Start PHP-FPM


Modify the FPM configuration file php-fpm.conf
Pm.max_children = 50
Pm.start_servers = 20
Pm.min_spare_servers = 5
Pm.max_spare_servers = 35
Pm.max_requests = 500
Remove semicolon

Ln-s/USR/LOCAL/PHP/SBIN/PHP-FPM/BIN/PHP-FPM
Cp/usr/local/src/php/php.ini-producsion/usr/local/php/lib/php.ini//This step may not be successful okay


This php-fpm installation completes editing the php.ini file Vi/etc/php.ini will Cgi.fix_pathinfobefore the # removalVI/etc/php-fpm.d/www.conf Modify Listen = 127.0.0.1:9000start Systemctl start php-fpmModify Nginx config file I was compiled and installed so it is in VI/usr/local/nginx/conf/nginx.conf
Take root out of location/then add index.php to index.htm and configure the path to root is the Nginx HTML file and set PHP
Replace a variable before $fastcgi_script_name in Fastcgi_param with the Nginx HTML file locationthen start Nginx, restart Nginx/usr/local/nginx/sbin/nginx Start/usr/local/nginx/sbin/nginx-s Reload Restart

mysql5.5.15 compiling and installing shorthand there are a few things to install first. Yuminstall Ncurses-develYuminstall Bison-develYum Install Libaio-develYuminstall gcc-c++ and then unzip, start compiling mysql5.5cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/data/ Mysql/mysql.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dwith_extra_charsets=all-dwith_ Myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1- denabled_local_infile=1-dmysql_datadir=/data/mysql-dmysql_user=mysql-dmysql_tcp_port=3306  

RM-RF/ETC/MY.CNF #删除系统默认的配置文件 (if not removed by default)

Cd/usr/local/mysql #进入MySQL安装目录

./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql #生成mysql系统数据库

Ln-s/usr/local/mysql/my.cnf/etc/my.cnf #添加到/etc directory soft connection

CP./SUPPORT-FILES/MYSQL.SERVER/ETC/RC.D/INIT.D/MYSQLD #把Mysql加入系统启动

chmod 755/etc/init.d/mysqld #增加执行权限

Chkconfig mysqld on #加入开机启动

Vi/etc/rc.d/init.d/mysqld #编辑

Basedir=/usr/local/mysql #MySQL程序安装路径

Datadir=/data/mysql #MySQl数据库存放目录

Service mysqld Start #启动

Vi/etc/profile #把mysql服务加入系统环境变量: Add the following line at the end

Export path= $PATH:/usr/local/mysql/bin

Source/etc/profile

The following two lines link the MYSLQ library file to the default location of the system, so you can compile software like PHP without specifying the MySQL library file address.

Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql

Ln-s/usr/local/mysql/include/mysql/usr/include/mysql

Mkdir/var/lib/mysql #创建目录

Ln-s/data/mysql/mysql.sock/var/lib/mysql/mysql.sock #添加软链接

Mysql_secure_installation #设置Mysql密码, press Y to enter the password 2 times according to the prompt

MySQL configuration can be connected remotely

Grant all privileges on * * to [email protected] '% ' identified by ' 123456 ';
Root indicates the user name that is logged in remotely
123456 means password
% means all IPs, or you can set your own IP

CENTOS7 Configuring the NMP environment

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.