1. 程式人生 > >mysql + php + nginx (LNMP)原始碼編譯安裝

mysql + php + nginx (LNMP)原始碼編譯安裝

mysql原始碼編譯安裝

mysql原始碼安裝需要使用c++的boost庫,而mysql-boost壓縮包自帶boost庫,不需要在下載boost安裝包,mysql在3.8版本以後使用cmake跨平臺工具預編譯原始碼,用於設定mysql的編譯引數;bison 一種linux下的c/c++語法分析器;

###解壓壓縮包編譯安裝環境###
[[email protected] ~]# tar -zxf mysql-boost-5.7.11.tar.gz 
[[email protected] ~]# cd mysql-5.7.11/
[[email protected]
mysql-5.7.11]# du -sh ##檢視資料庫解壓包大小 521M . [[email protected] mysql-5.7.11]# ls boost dbug libevent plugin testclients BUILD Docs libmysql README unittest client Doxyfile-perfschema libmysqld regex VERSION cmake extra libservices scripts vio CMakeLists.txt include man sql win cmd-line-utils INSTALL mysql-test sql-common zlib config.h.cmake INSTALL-SOURCE mysys storage configure.cmake libbinlogevents mysys_ssl strings COPYING libbinlogstandalone packaging support-files [
[email protected]
mysql-5.7.11]# yum install -y cmake [[email protected] mysql-5.7.11]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all
##執行編譯後報錯## CMake Error at CMakeLists.txt:21 (CMAKE_MINIMUM_REQUIRED): CMake 2.8.2 or higher is required. You are running version 2.6.4 我們安裝的cmake版本過低,需要安裝2.8.2版本或者以上 [[email protected] ~]# yum update cmake-2.8.12.2-4.el6.x86_64.rpm ###升級版本再次執行編譯,以下列出編譯時我遇見的錯誤 CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name. [[email protected] mysql-5.7.11]# yum install -y gcc gcc-c++ CMake Error at cmake/boost.cmake:81 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory> [[email protected] mysql-5.7.11]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_BOOST=boost/boost_1_59_0/ ###boost解壓包自帶,不知道路徑時兩次tab補齊 CMake Error at cmake/readline.cmake:64 (MESSAGE): Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. ##提示我們需要刪除編譯檔案CMakeCache.txt,解決相關報錯,再次執行編譯,後面步驟同以上步驟! [[email protected] mysql-5.7.11]# rm -fr CMakeCache.txt [[email protected] mysql-5.7.11]# yum install -y ncurses-devel Make Warning at cmake/bison.cmake:20 (MESSAGE): Bison executable not found in PATH Call Stack (most recent call first): libmysqld/CMakeLists.txt:142 (INCLUDE) [[email protected] mysql-5.7.11]# yum install -y bison 以上就是我編譯安裝遇見的問題! make && make install ##編譯環境和安裝需要很長時間 ####配置檔案和啟動指令碼### [[email protected] support-files]# pwd /usr/local/mysql/support-files [[email protected] support-files]# ls magic my-default.cnf mysqld_multi.server mysql-log-rotate mysql.server [[email protected] support-files]# file mysql.server mysql.server: POSIX shell script text executable <mysql的啟動指令碼> [[email protected] support-files]# cp mysql.server /etc/init.d/mysql [[email protected] support-files]# mv /etc/my.cnf /etc/my.cnf.bak <將原來配置配置檔案備份,複製模板到改目錄> [[email protected] support-files]# cp my-default.cnf /etc/my.cnf<mysql預設配置檔案> ###建立mysql執行的使用者mysql### [[email protected] mysql]# id mysql id: mysql: No such user [[email protected] mysql]# groupadd -g 27 mysql [[email protected] mysql]# useradd -u 27 -g 27 -d /usr/local/mysql/data -M -s /sbin/nologin mysql [[email protected] mysql]# id mysql uid=27(mysql) gid=27(mysql) groups=27(mysql) ##編輯安裝,data資料以及sock檔案路徑,讓其他人知道你的安裝目錄利於修改## [[email protected] mysql]# vi /etc/my.cnf 17 # These are commonly set, remove the # and set as required. 18 basedir = /usr/local/mysql 19 datadir = /usr/local/mysql/data 20 port = 3306 21 # server_id = ..... 22 socket = /usr/local/mysql/data/mysql.sock ###將mysql的系統檔案新增到全域性變數和環境下### [[email protected] bin]# pwd /usr/local/mysql/bin [[email protected] bin]# ls innochecksum mysql_config mysqlshow lz4_decompress mysql_config_editor mysqlslap myisamchk mysqld mysql_ssl_rsa_setup myisam_ftdump mysqld_multi mysqltest myisamlog mysqld_safe mysqltest_embedded myisampack mysqldump mysql_tzinfo_to_sql my_print_defaults mysqldumpslow mysql_upgrade mysql mysql_embedded perror mysqladmin mysqlimport replace mysqlbinlog mysql_install_db resolveip mysqlcheck mysql_plugin resolve_stack_dump mysql_client_test mysqlpump zlib_decompress mysql_client_test_embedded mysql_secure_installation [[email protected] bin]# vim ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin:/usr/local/mysql/bin export PATH [[email protected] bin]# source ~/.bash_profile ###為了資料庫的安全,指定data資料其他人可讀,其他檔案無許可權,視情況而定### [[email protected] mysql]# pwd /usr/local/mysql [[email protected] mysql]# chown mysql.mysql . -R [[email protected] mysql]# chown root . -R [[email protected] mysql]# chown mysql data/ -R [[email protected] mysql]# ll total 60 drwxr-xr-x 2 root mysql 4096 Jun 30 01:09 bin -rw-r--r-- 1 root mysql 17987 Feb 2 2016 COPYING drwxr-x--- 5 mysql mysql 4096 Jun 30 01:37 data drwxr-xr-x 2 root mysql 4096 Jun 30 01:09 docs drwxr-xr-x 3 root mysql 4096 Jun 30 01:09 include drwxr-xr-x 4 root mysql 4096 Jun 30 01:09 lib drwxr-xr-x 4 root mysql 4096 Jun 30 01:09 man drwxr-xr-x 10 root mysql 4096 Jun 30 01:09 mysql-test -rw-r--r-- 1 root mysql 2478 Feb 2 2016 README drwxr-xr-x 28 root mysql 4096 Jun 30 01:10 share drwxr-xr-x 2 root mysql 4096 Jun 30 01:10 support-files ###資料庫系統初始化,使用的命令:mysql目錄下執行該命令或者使用絕對路徑執行!### [[email protected] mysql]# mysql_install_db 2018-06-30 01:32:11 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2018-06-30 01:32:11 [ERROR] The data directory needs to be specified. [[email protected] mysql]# mysqld --verbose --help | less ###查詢支援的引數 [[email protected] mysql]# mysqld --initialize --user=mysql ##初始化資料庫,以mysql身份執行#### 2018-06-29T17:37:00.664303Z 1 [Note] A temporary password is generated for [email protected]: OtgrgPd6;tN(初始化密碼) *** ###mysql資料庫的安全配置### [[email protected] mysql]# mysql_secure_installation 初始化時遇見問題: ecuring the MySQL server deployment. Enter password for user root: Error: Access denied for user 'root'@'localhost' (using password: YES) ####複製貼上時初始密碼沒有對,多試幾次#### [[email protected] ~]# mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: (複製貼上初始密碼) The existing password for the user account root has expired. Please set a new password. New password:(為資料庫設定新的密碼一般由數字字母特殊字元組成的八個字元) Re-enter new password: VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? ###資料庫檢驗我們的密碼強度是否符和要求,太弱讓我們更改密碼,如果你認為你的密碼合適,可以不用修改!##### Press y|Y for Yes, any other key for No: n Using existing password for root. Change the password for root ? ((Press y|Y for Yes, any other key for No) : n ####請求是否修改root使用者的密碼#### ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : y ####是否刪除匿名使用者,生產環境建議刪除###### Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. ######是否允許root使用者遠端登入,根據實際情況而定###### Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. ######是否刪除test資料庫###### Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. ####是否現在重新載入許可權表,y是####### Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success. ####登入資料庫進行測試##### [[email protected] ~]# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.11 Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> databases show; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databases show' at line 1 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) mysql> create database westos; ####為資料庫建立westos的資料庫表### Query OK, 1 row affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | westos | +--------------------+ 5 rows in set (0.00 sec) mysql> exit Bye ####進入資料庫data目錄檢視多出westos檔案###### [[email protected] ~]# cd /usr/local/mysql/data/ [[email protected] data]# ls auto.cnf ib_logfile0 mysql mysql.sock.lock server1.pid ib_buffer_pool ib_logfile1 mysqld_safe.pid performance_schema sys ibdata1 ibtmp1 mysql.sock server1.err westos

php原始碼編譯安裝

###解壓壓縮包,進入解壓目錄,編譯配置環境###
[[email protected] ~]# tar jxf php-5.6.35.tar.bz
[[email protected] ~]# cd php-5.6.35
[[email protected] php-5.6.35]# ./configure --help 
[[email protected] php-5.6.35]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --enable-mysqlnd  --with-openssl --with-snmp --with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-pear --with-gettext --with-gmp  --enable-inline-optimization --enable-soap --enable-ftp --enable-sockets --enable-mbstring --with-mysqli=mysqlnd --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mcrypt --with-mhash


###編譯時遇見的報錯問題###
configure: error: xml2-config not found. Please check your libxml2 installation.
[[email protected] ~]#yum install -y libxml2-devel-2.7.6-14.el6.x86_64
warning: libmcrypt-2.5.8-9.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:libmcrypt              ########################################### [ 50%]
   2:libmcrypt-devel        ########################################### [100%]

configure: error: Cannot find OpenSSL's <evp.h>
[[email protected] php-5.6.35]# yum install -y openssl-devel
[[email protected] ~]# rpm -ivh re2c-0.13.5-1.el6.x86_64.rpm 
warning: re2c-0.13.5-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:re2c                   ########################################### [100%]


configure: error: Please reinstall the libcurl distribution -
    easy.h should be in <curl-dir>/include/curl/
[[email protected] php-5.6.35]# yum install -y  libcurl-devel


If configure fails try --with-vpx-dir=<DIR>
configure: error: jpeglib.h not found.
[[email protected] php-5.6.35]# yum provieds */jpeglib.h
###有些缺失檔案或者其他東西,yum provides 缺失的檔案:查詢由那些軟體提供的檔案或者其他之類!
[[email protected] php-5.6.35]# yum install -y libjpeg-turbo-devel-1.2.1-1.el6.x86_64

configure: error: png.h not found.

configure: error: freetype-config not found.
[[email protected] php-5.6.35]# yum install -y freetype-devel-2.3.11-14.el6_3.1.x86_64

configure: error: Unable to locate gmp.h
[[email protected] php-5.6.35]# yum install -y gmp-devel-4.3.1-7.el6_2.2.x86_64 


configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
[[email protected] php-5.6.35]# yum install -y net-snmp-devel-5.5-49.el6.x86_64


####出現下面表示我們編譯環境完成#####
Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands

####編譯以及安裝php####
make  &&  make  install     

###建立php執行使用者nginx###
[[email protected] etc]# useradd -M -s /sbin/nologin nginx

###php配置檔案###
[[email protected] php-5.6.35]# cp php.ini-production  /usr/local/php/etc/php.ini
[[email protected] php-5.6.35]# cd /usr/local/php/etc/
[[email protected] etc]# ls
pear.conf  php-fpm.conf.default  php.ini
##複製模板未配置檔案###
[[email protected] etc]# cp php-fpm.conf.default php-fpm.conf 
###編輯配置檔案去掉註釋php執行的id###  
[[email protected] etc]# vim php-fpm.conf
 25 pid = run/php-fpm.pid
 ###設定上海時區###
[[email protected] etc]# vim php.ini 
 936 date.timezone = Asia/Shanghai
###防止php啟動時報錯##
[[email protected] php-7.0.32]# /etc/init.d/php-fpm start
Starting php-fpm [17-Sep-2018 07:21:00] WARNING: Nothing matches the include pattern '/usr/local/php/etc/php-fpm.d/*.conf' from /usr/local/php/etc/php-fpm.conf at line 125.
[17-Sep-2018 07:21:00] ERROR: No pool defined. at least one pool section must be specified in config file
[17-Sep-2018 07:21:00] ERROR: failed to post process the configuration
[17-Sep-2018 07:21:00] ERROR: FPM initialization failed
 failed
解決辦法:報錯在/usr/local/php/etc/php-fpm.d/目錄下找不到*.conf檔案
[[email protected] php-fpm.d]# pwd
/usr/local/php/etc/php-fpm.d
[[email protected] php-fpm.d]# ls
www.conf.default
[[email protected] php-fpm.d]# cp www.conf.default www.conf



###php啟動腳複製到/etc/init.d/目錄下,新增執行許可權####
[[email protected] fpm]# pwd
/root/php-5.6.35/sapi/fpm
[[email protected] fpm]# ls
config.m4          LICENSE        php-fpm.conf        status.html.in
CREDITS            Makefile.frag  php-fpm.conf.in     tests
fpm                php-fpm        php-fpm.service     www.conf.in
init.d.php-fpm     php-fpm.8      php-fpm.service.in
init.d.php-fpm.in  php-fpm.8.in   status.html
[[email protected] fpm]# file init.d.php-fpm
init.d.php-fpm: POSIX shell script text executable
###備份之前配置檔案,複製模板未配置檔案###
[[email protected] fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[[email protected] fpm]# chmod +x /etc/init.d/php-fpm 
[[email protected] fpm]# /etc/init.d/php-fpm start
Starting php-fpm  done
[[email protected] ~]# netstat -antpl
#####檢視配置檔案php監聽的埠號127.0.0.1:9000是否存在,如果不存在說名啟動有問題#####
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      13930/php-fpm  

nginx原始碼編譯安裝

nginx官網下載地址:nginx

###解壓壓縮包,進入解壓目錄,編譯安裝環境###
[[email protected] ~]# tar zxf nginx-1.10.1.tar.gz 
[[email protected] ~]# cd nginx-1.10.1
[[email protected] nginx-1.10.1]# ls
auto     CHANGES.ru  configure  html     man     src
CHANGES  conf        contrib    LICENSE  README

###不展示nginx的版本號###
[[email protected] nginx-1.10.1]# vim src/core/nginx.h 
14 #define NGINX_VER          "nginx/" 
{{{如果去掉註釋,編譯時會報錯找不到指定版本號,缺少其他一些東西,報錯擷取一部分
src/core/nginx.h:14: error: expected ‘=’, ‘,’, ‘;’, ‘asmor ‘__attribute__’ beforeNGINX_VERsrc/core/nginx.c:158: error: variablengx_core_modulehas initializer but incomplete type
cc1: warnings being treated as errors
src/core/nginx.c:159: error: excess elements in struct initializer
src/core/nginx.c:159: error: (near initialization forngx_core_module’)
src/core/nginx.c:159: error: excess elements in struct initializer
src/core/nginx.c:159: error: (near initialization forngx_core_module’)
src/core/nginx.c:159: error: excess elements in struct initializer
src/core/nginx.c:159: error: (near initialization forngx_core_module’)}}}

###註釋編譯時佔用很少部分空間###
[[email protected] nginx-1.10.1]# vim auto/cc/gcc 
179 #CFLAGS="$CFLAGS -g"

[[email protected] ~]# tar -zxf nginx-sticky-module-ng.tar.gz 
[[email protected] nginx-1.10.1]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-threads  --with-file-aio --add-module=/root/nginx-sticky-mod


###編譯環境時遇見的錯誤###
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
[[email protected] nginx-1.10.1]# yum install -y pcre-devel
[[email protected] nginx-1.10.1]#make  &&  make install 


###編譯nginx配置檔案,使nginx支援php檔案###
[[email protected] conf]# pwd
/usr/local/nginx/conf
[[email protected] conf]# vim nginx.conf
  2 user  nginx nginx;

 43         location / {
 44             root   html;
 45             index  index.php index.html index.htm;
 46         }

 65         location ~ \.php$ {
 66             root           html;
 67             fastcgi_pass   127.0.0.1:9000;
 68             fastcgi_index  index.php;
 69         #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 70             include        fastcgi.conf;
 71         }
###檢查語法有沒有錯誤###
[[email protected] ~]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
###重新載入nginx配置檔案###
[[email protected] ~]# nginx -s reload
[[email protected] ~]# nginx 
###建立軟連線###
[[email protected] conf]# ln -s /usr/local/nginx/sbin/nginx /sbin/
###編輯php檔案,向我們展示安裝的php資訊####
[[email protected] conf]# vim /usr/local/nginx/html/index.php
[[email protected] conf]# cat /usr/local/nginx/html/index.php
<?php
phpinfo()
?>
[[email protected] ~]# netstat -antplue
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      0          22762      15586/php-fpm       

客戶端php測試:輸入172.25.60.1
客戶端php測試

搭建論壇測試lnmp平臺

###將論壇壓縮包解壓到nginx的html目錄下,網頁進行安裝論壇###
[root@server1 ~]# cd  /usr/local/nginx/html/
[root@server1 html]# ls
50x.html  Discuz_X3.2_SC_UTF8.zip  index.html  index.php
[root@server1 html]# unzip Discuz_X3.2_SC_UTF8.zip 
-bash: unzip: command not found
[root@server1 html]# yum install -y unzip
[root@server1 html]# unzip Discuz_X3.2_SC_UTF8.zip 
[root@server1 html]# mv upload bbs

瀏覽器輸入172.25.60.1/bbs/install/ 回車開始進行安裝
安裝論壇
這裡寫圖片描述

改變檔案的目錄許可權
[root@server1 bbs]# chmod 777 config/ data/ uc_client/ uc_server/ -R

這裡寫圖片描述
選擇全新安裝
這裡寫圖片描述

這裡寫圖片描述

[[email protected] etc]# vim php.ini 
1013 pdo_mysql.default_socket= /usr/local/mysql/data/mysql.sock
1162 mysql.default_socket = /usr/local/mysql/data/mysql.sock
1221 mysqli.default_socket = /usr/local/mysql/data/mysql.sock
[[email protected] etc]# /etc/init.d/php-fpm reload
Reload service php-fpm  done

每次需要重新整理頁面重新發送內容
這裡寫圖片描述

更改資料庫data的目錄許可權
[[email protected] mysql]# ls -ld data/
drwxr-x--- 5 mysql mysql 4096 Jun 30 10:02 data/
[[email protected] mysql]# chmod 755 data/
[[email protected] mysql]# ls -ld data/
drwxr-xr-x 5 mysql mysql 4096 Jun 30 10:02 data/

這裡寫圖片描述
資料庫沒有啟動

[root@server1 ~]# /etc/init.d/mysql start
Starting MySQL SUCCESS! 

這裡寫圖片描述
安裝完成點選右下角進入論壇
這裡寫圖片描述
刪除檔案防止再次重複安裝

[root@server1 install]# pwd
/usr/local/nginx/html/bbs/install
[root@server1 install]# ls
data  images  include  index.php
[root@server1 install]# rm -f index.php

memcache安裝以及測試

phpize是一個shell指令碼,用來擴充套件php擴充套件模組,通過phpize可以安裝第三方模組。

###將phpzie編譯新增到全域性環境變數###
[root@server1 install]# cd /usr/local/php/bin/
[root@server1 bin]# ls
pear  peardev  pecl  phar  phar.phar  php  php-cgi  php-config  phpize
[root@server1 bin]# vim ~/.bash_profile 
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/php/bin
[root@server1 bin]# source ~/.bash_profile 
[root@server1 bin]# which phpize
/usr/local/php/bin/phpize

###解壓memcache壓縮包,編譯安裝memcache###
[root@server1 ~]# tar xf memcache-2.2.5.tgz 
[root@server1 ~]# cd memcache-2.2.5
[root@server1 memcache-2.2.5]# ./configure 
[root@server1 memcache-2.2.5]# make 
[root@server1 memcache-2.2.5]# make install 
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
[root@server1 memcache-2.2.5]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
memcache.so  opcache.a  opcache.so

###讓php支援memcache擴充套件###
[root@server1 memcache-2.2.5]# vim /usr/local/php/etc/php.ini 
869 ;   extension=msql.dll
870 extension=memcache.so
[root@server1 memcache-2.2.5]# /etc/init.d/php-fpm reload
Reload service php-fpm  done
[root@server1 memcache-2.2.5]# /etc/init.d/memcached start
Starting memcached:                                        [  OK  ]
[root@server1 memcache-2.2.5]# netstat -antplue
tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      498        30756      18429/memcached   

相關推薦

mysql + php + nginx LNMP原始碼編譯安裝

mysql原始碼編譯安裝 mysql原始碼安裝需要使用c++的boost庫,而mysql-boost壓縮包自帶boost庫,不需要在下載boost安裝包,mysql在3.8版本以後使用cmake跨平臺工具預編譯原始碼,用於設定mysql的編譯引數;biso

Spark入門實戰系列--2.Spark編譯與部署--Hadoop編譯安裝

二進制包 1.10 不能 mapr 修復 att 機器 mave end 【註】該系列文章以及使用到安裝包/測試數據 能夠在《[傾情大奉送–Spark入門實戰系列] (http://blog.csdn.net/yirenboy/article/deta

1Ngixn 編譯安裝 版本:1.12.1

fix map img login 版本 查看 tool sbin yum 1.創建用戶和群組 groupadd nginx 創建一個用戶,不允許登陸和不創主目錄 useradd -s /sbin/nologin -g nginx -M n

PHP入門2WampServer的安裝及使用

安裝 一直點選next即可。 如何檢驗環境配置成功 (1)開啟WampServer,會有一個cmd視窗一閃而過。 (2)桌面右下角工作列中WampServer圖示變為綠色,若一直為橙色或紅色則表示服務沒有完全開啟。 (3)左鍵單擊右下角工作列中WampServer圖示,單擊Lo

【原創】運維基礎之Nginx1簡介、安裝、使用

官方:http://nginx.org nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by

JDK編譯安裝JDK

Nginx:    安裝:如果安裝了OpenJdk先刪除在/tmp,放入jdk-8u162-linux-x64.rpm(見U盤或者百度網盤) cd /tmprpm -ivh jdk-8u162-linux-x64.rpm    (rpm安裝JDK) vi /et

基於linux + nginx + mysql + php原始碼安裝及搭建

lnmp是什麼? LNMP指的是一個基於CentOS/Debian編寫的Nginx、PHP、MySQL、phpMyAdmin、eAccelerator一鍵安裝包。可以在VPS、獨立主機上輕鬆的安裝LNMP生產環境。 簡介: LNMP代表的就是:Linux系

PHP-原始碼編譯安裝李作強

yum install http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-devel-6.1.6-1.linux_glibc2.5.x86_64.rpm yum -y install libcurl-devel

建站教程:Ubuntu上如何配置Nginx+MySQL+PHP7LNMP

在Linux上搭建個人網站,最常用的就是Nginx+MySQL+PHP環境,即LNMP。搭建LNMP的一鍵指令碼很多,不過本文介紹如何不用指令碼一步一步自己搭建LNMP環境,這樣以後自己的網站遇到什麼問題也會清楚如何修改。 安裝Nginx Ubutun(本教程是基於U

MySQL5.6原始碼編譯安裝CentOS-6.6+MySQL-5.6(一)

原文地址:http://my.oschina.net/wushuicheng/blog/551621 《基於Dubbo的分散式系統架構視訊教程》 高可用架構篇 MySQL原始碼編譯安裝(CentOS-6.6+MySQL-5.6) 部署環

sentos7原始碼編譯安裝mysql指令碼自動化安裝

一、下載mysql安裝包https://dev.mysql.com/downloads/mysql/5.7.html#downloads選擇自己需要的版本,我這裡的是5.6.40版本二、在root根目錄寫安裝的指令碼vim mysql_install.sh#!/bin/bas

關於wamp的HTML, PHPmysql 三者的操作與聯系 - mysql簡單配置

長度 -1 logs 建議 用戶 不用 自帶 .com upd   上一章講完HTML與PHP之間的傳值方法,這一章將wamp中mysql的使用,為下一章PHP調用數據準備。 再次說明作者的wamp版本是3.0.6 64bit   打開wamp自帶的mysql試圖數據庫

最快最簡單的部署本地Apache+PHP+MySQL神器USBWebserver

包含 .com col 最快最簡單 dmi 分享圖片 admin 目錄 www. 搭建本地服務器環境的軟件有很多,比如什麽PHPNOW、Almp、XAMPP等等好多;<br> 之前分享過一個《網站本地搭建PHP+Mysql環境運行網站教程》用是PHPno

centos7.4 編譯安裝php5.6 LNMP

location -i free lar gin 啟動 b- png () centos7.4前提: 1、需要提前安裝msyql數據庫(yum,二進制,自己編譯都行) 2、需要自己編寫windows的hosts文件,綁定域名和ip 3、nginx使用yum

解決php工具箱phpStudyApache啟動成功,MySql無法啟動的問題

php工具箱 mysql無法啟動 今天花了兩個多小時的時間給別人搗鼓php工具箱,自己都很驚訝。 由於xampp中的不太適合新手剛開始學php使用,所以我給她安裝了php工具箱,這是個可以切換版本的軟件,我很推薦,而且不需要配置! 不過很讓人頭疼的是Apache正常啟動,,MySql就是無法啟動,百度

Centos 7Linux環境下安裝PHP編譯添加相應動態擴展模塊so以openssl.so為例

linu *** bz2 restart lan openssl 發現 不知道 tails https://blog.csdn.net/shinesun001/article/details/54312402 在centos 7環境下搭建好Lnmp環境之後,發現安裝的php

DockerFile部署lnmp+memcached+redis+mongodb開發環境for Nginx

name tor dir wall ech permanent roo emp login 本文源鏈接地址:https://www.93bok.com 1、下載基礎鏡像centos docker pull centos:6 2、查看一下大小 docker images RE

01-postgres9.4.5在redhat6.5環境下原始碼編譯安裝2016-11-08

0讀者須知 1安裝redhat65 2更改本地yum源 4解壓postgres 5安裝依賴包 6增加使用者設定密碼 7開始編譯和安裝postgres 8設定環境變數 9初始化資

Node--Ubuntu下原始碼編譯安裝Node.js時間比較長

一.下載地址 下載地址:https://nodejs.org/en/download/ 二.下載原始碼 [email protected]:~# cd /usr/local/src/ [email protected]:/usr/local/src# wget

PHP MySQL 持久連線mysql_pconnect

PHP MySQL 持久連線(mysql_pconnect) 先來一段 PHP 連線 MySQL 的經典程式碼: 1 2 3 4 5 6 7 8 <?php $con = mysql_connect("localhost", "root", "1