30年八字起名经验,起名专业权威,已为近十万名宝宝起名,好评率高达99.9%平台的搭建
只能用来学习研究使用,切勿商用或牟利,请大家遵守好这个规则,如果侵犯了你,请联系小编立即删除
- 本文涉及到的知识点
- lnmp架构的搭建
- php之pdo_mysql扩展的部署
先看效果图
系统环境
系统 | 系统版本 | 内存 | ip | 网络模式 |
---|---|---|---|---|
Linux | centos7.5 | 2G | 192.168.100.153 | NAT(也就是可以上网) |
实时步骤
lnmp环境搭建部署
- 参照小编的另一个文章
lnmp架构搭建-基于linux系统centos7.5
部署pdo_mysql扩展
##首先确保nginx,php,mysql服务全部开启
[root@lnmp ~]# ss -antup | grep 80
tcp LISTEN 0 80 *:3306 *:* users:(("mysqld",pid=1801,fd=10))
tcp LISTEN 0 128 *:80 *:* users:(("nginx",pid=1489,fd=6),("nginx",pid=1488,fd=6))
[root@lnmp ~]# ss -antup | grep 9000
tcp LISTEN 0 128 127.0.0.1:9000 *:* users:(("php-fpm",pid=1493,fd=0),("php-fpm",pid=1492,fd=0),("php-fpm",pid=1491,fd=7))
[root@lnmp ~]# ss -antup | grep 3306
tcp LISTEN 0 80 *:3306 *:* users:(("mysqld",pid=1801,fd=10))
[root@lnmp ~]# php -m #检查php编译部署时安装的扩展,发现没有pdo_mysql
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
ereg
fileinfo
filter
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib
###开始部署一下pdo_mysql扩展
[root@lnmp ~]# cd /usr/src/php-5.6.40/ #到之前解压php压缩包的目录下面
[root@lnmp php-5.6.40]# cd ext/ #到扩展目录里面
[root@lnmp ext]# cd pdo_mysql/ #到pdo_mysql扩展目录里面,准备进行编译
[root@lnmp pdo_mysql]# find / -type f -name "*phpize*" #查找phpize命令所在位置
/usr/local/php/lib/php/build/phpize.m4
/usr/local/php/bin/phpize #这个就是我们要找的phpize命令
/usr/local/php/php/man/man1/phpize.1
/usr/src/php-5.6.40/scripts/man1/phpize.1.in
/usr/src/php-5.6.40/scripts/man1/phpize.1
/usr/src/php-5.6.40/scripts/phpize.m4
/usr/src/php-5.6.40/scripts/phpize.in
/usr/src/php-5.6.40/scripts/phpize
/usr/src/php-5.6.40/win32/build/phpize.js.in
/usr/src/php-5.6.40/win32/build/Makefile.phpize
/usr/src/php-5.6.40/win32/build/config.w32.phpize.in
/usr/src/php-5.6.40/win32/build/phpize.bat
[root@lnmp pdo_mysql]# /usr/local/php/bin/phpize #利用绝对路径执行命令
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Cannot find autoconf. Please check your autoconf installation and the ####发现报错,提示没有autoconf服务
$PHP_AUTOCONF environment variable. Then, rerun this script.
[root@lnmp pdo_mysql]# yum -y install autoconf #安装autoconf服务
已加载插件:fastestmirror
Determining fastest mirrors
epel/x86_64/metalink | 5.4 kB 00:00:00
* base: mirrors.bfsu.edu.cn
* epel: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.bfsu.edu.cn
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): epel/x86_64/group_gz | 96 kB 00:00:00
(2/4): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/4): epel/x86_64/primary_db | 6.9 MB 00:00:00
(4/4): updates/7/x86_64/primary_db | 5.7 MB 00:00:02
正在解决依赖关系
--> 正在检查事务
---> 软件包 autoconf.noarch.0.2.69-11.el7 将被 安装
--> 正在处理依赖关系 m4 >= 1.4.14,它被软件包 autoconf-2.69-11.el7.noarch 需要
--> 正在检查事务
---> 软件包 m4.x86_64.0.1.4.16-10.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================================================================================
Package 架构 版本 源 大小
=================================================================================================================================================
正在安装:
autoconf noarch 2.69-11.el7 base 701 k
为依赖而安装:
m4 x86_64 1.4.16-10.el7 base 256 k
事务概要
=================================================================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:957 k
安装大小:2.7 M
Downloading packages:
(1/2): m4-1.4.16-10.el7.x86_64.rpm | 256 kB 00:00:00
(2/2): autoconf-2.69-11.el7.noarch.rpm | 701 kB 00:00:01
-------------------------------------------------------------------------------------------------------------------------------------------------
总计 485 kB/s | 957 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : m4-1.4.16-10.el7.x86_64 1/2
正在安装 : autoconf-2.69-11.el7.noarch 2/2
验证中 : m4-1.4.16-10.el7.x86_64 1/2
验证中 : autoconf-2.69-11.el7.noarch 2/2
已安装:
autoconf.noarch 0:2.69-11.el7
作为依赖被安装:
m4.x86_64 0:1.4.16-10.el7
完毕!
[root@lnmp pdo_mysql]# /usr/local/php/bin/phpize #再次执行命令
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@lnmp pdo_mysql]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/ #第一个路径是编译安装php的路径,第二个路径是编译安装的路径
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for MySQL support for PDO... yes, shared
checking for the location of libz... no
checking for mysql_config... /usr/local/mysql//bin/mysql_config
checking for mysql_commit in -lmysqlclient... yes
checking for PDO includes... checking for PDO includes... /usr/local/php/include/php/ext
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
[root@lnmp pdo_mysql]# make #make 一下
/bin/sh /usr/src/php-5.6.40/ext/pdo_mysql/libtool --mode=compile cc -I/usr/local/php/include/php/ext -I -I. -I/usr/src/php-5.6.40/ext/pdo_mysql -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.6.40/ext/pdo_mysql/pdo_mysql.c -o pdo_mysql.lo
mkdir .libs
cc -I/usr/local/php/include/php/ext -I -I. -I/usr/src/php-5.6.40/ext/pdo_mysql -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.6.40/ext/pdo_mysql/pdo_mysql.c -fPIC -DPIC -o .libs/pdo_mysql.o
/bin/sh /usr/src/php-5.6.40/ext/pdo_mysql/libtool --mode=compile cc -I/usr/local/php/include/php/ext -I -I. -I/usr/src/php-5.6.40/ext/pdo_mysql -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.6.40/ext/pdo_mysql/mysql_driver.c -o mysql_driver.lo
cc -I/usr/local/php/include/php/ext -I -I. -I/usr/src/php-5.6.40/ext/pdo_mysql -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.6.40/ext/pdo_mysql/mysql_driver.c -fPIC -DPIC -o .libs/mysql_driver.o
/bin/sh /usr/src/php-5.6.40/ext/pdo_mysql/libtool --mode=compile cc -I/usr/local/php/include/php/ext -I -I. -I/usr/src/php-5.6.40/ext/pdo_mysql -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.6.40/ext/pdo_mysql/mysql_statement.c -o mysql_statement.lo
cc -I/usr/local/php/include/php/ext -I -I. -I/usr/src/php-5.6.40/ext/pdo_mysql -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -c /usr/src/php-5.6.40/ext/pdo_mysql/mysql_statement.c -fPIC -DPIC -o .libs/mysql_statement.o
/bin/sh /usr/src/php-5.6.40/ext/pdo_mysql/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/src/php-5.6.40/ext/pdo_mysql/include -I/usr/src/php-5.6.40/ext/pdo_mysql/main -I/usr/src/php-5.6.40/ext/pdo_mysql -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/mysql//include -DHAVE_CONFIG_H -g -O2 -o pdo_mysql.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/src/php-5.6.40/ext/pdo_mysql/modules pdo_mysql.lo mysql_driver.lo mysql_statement.lo -Wl,-rpath,/usr/local/mysql//lib -L/usr/local/mysql//lib -lmysqlclient -lm -lssl -lcrypto -ldl
cc -shared .libs/pdo_mysql.o .libs/mysql_driver.o .libs/mysql_statement.o -L/usr/local/mysql//lib -lmysqlclient -lm -lssl -lcrypto -ldl -Wl,-rpath -Wl,/usr/local/mysql//lib -Wl,-soname -Wl,pdo_mysql.so -o .libs/pdo_mysql.so
creating pdo_mysql.la
(cd .libs && rm -f pdo_mysql.la && ln -s ../pdo_mysql.la pdo_mysql.la)
/bin/sh /usr/src/php-5.6.40/ext/pdo_mysql/libtool --mode=install cp ./pdo_mysql.la /usr/src/php-5.6.40/ext/pdo_mysql/modules
cp ./.libs/pdo_mysql.so /usr/src/php-5.6.40/ext/pdo_mysql/modules/pdo_mysql.so
cp ./.libs/pdo_mysql.lai /usr/src/php-5.6.40/ext/pdo_mysql/modules/pdo_mysql.la
PATH="$PATH:/sbin" ldconfig -n /usr/src/php-5.6.40/ext/pdo_mysql/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/src/php-5.6.40/ext/pdo_mysql/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
[root@lnmp pdo_mysql]# make install #make install 一下
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ #这个路径要记录下来
[root@lnmp pdo_mysql]# php --ini #查找php的配置文件位置
Configuration File (php.ini) Path: /usr/local/php/etc
Loaded Configuration File: /usr/local/php/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
[root@lnmp pdo_mysql]# echo "extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql.so" >> /usr/local/php/etc/php.ini #修改php的配置文件,里面的路径就是上面要记得路径后面加上pdo_mysql.so文件
[root@lnmp pdo_mysql]# php -m | grep pdo
pdo_mysql #发现已经有了pdo_mysql扩展了,再这里先不忙着重启php,到最后统一重启
pdo_sqlite
修改nginx配置文件
因为这个源码带有think_php,所以咱的修改一下nginx的配置文件
[root@lnmp pdo_mysql]# cd
[root@lnmp ~]#
##将nginx的配置文件修改成下面这样子的
[root@lnmp ~]# cat /usr/local/nginx/conf/nginx.conf
worker_processes 10;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ .+\.php($|/) {
#fastcgi_pass unix:/dev/shm/php-fcgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
#后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
#加载Nginx默认"服务器环境变量"配置
include fastcgi.conf;
}
}
}
拷贝源码到服务器网站根目录下面
如果按照上面的来的话,网站根目录是/usr/local/nginx/html/
自行下载解压到网站根目录
链接:https://pan.baidu.com/s/1xsarXiKTk0VvpZq73boQlQ
提取码:g9r5
复制这段内容后打开百度网盘手机App,操作更方便哦
修改源码数据库连接文件
##数据库配置文件路径是 Application/Common/Conf/config.php
[root@lnmp ~]# cd /usr/local/nginx/html/
[root@lnmp html]# ls
Application favicon.ico license.php Public test.php ░▓╫░╓╕╥¤.txt ╓г╓╪╔∙├ў.txt 数据库
404.html asp.php images lunar.php ThinkPHP web.config ┤╦░ц▒╛╝▄╔ш╦╡├ў.txt
admin.php cy.php index.php m QQKfimg txt ys.php 起名.zip
[root@lnmp html]# cat Application/Common/Conf/config.php #改成下面这样的
<?php
return array(
'DB_TYPE' => 'mysql', // 数据库类型
'DB_HOST' => '192.168.100.153', // 服务器地址
'DB_NAME' => 'zgymw', // 数据库名
'DB_USER' => 'root', // 用户名
'DB_PWD' => '123456', // 密码
'DB_PORT' => '3306', // 端口
'DB_PREFIX' => '', // 数据库表前缀
//安全过滤
'DEFAULT_FILTER' => 'safe_filter,strip_tags,stripslashes,htmlspecialchars',
);
- 可能你的没有数据库文件,那是因为你解压后它是目录名是乱码,可以自己找找,网站根目录下面文件名是乱码的,而且还没有后缀的,那就是了,通过mv改下名字就行了
配置数据库
[root@lnmp html]# mysql -uroot -p123456 -h192.168.100.153
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 399
Server version: 5.6.39 Source distribution
Copyright (c) 2000, 2018, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> create database zgymw;
Query OK, 1 row affected (0.00 sec)
mysql> use zgymw;
Database changed
mysql> source /usr/local/nginx/html/数据库/zgymw.sql; #导入数据库数据,这个时间会非常的长,请耐心等待
mysql> exit #退出数据库
Bye
重启nginx,php,mysqld
这里不做演示
登录起名平台后台
后台地址: http://你的域名/admin.php
后台账号密码:用户:admin 密码 zgymw.com
登录平台
平台地址: http://你的域名/
更改付款状态
由于本源码没有手动修改付款状态的功能,所以还得在数据库中修改,小编只给大家提供一下修改sql语句,大家一看就没明白了
mysql> update zgymw.order set state=1 where state=0;
Query OK, 17 rows affected (0.00 sec)
结束语
- 只是用来学习用,切勿商用
- 不要用来牟利,干不正当之事
- 本人也是从别人手中购买的源码,且行且珍惜