--prefix 这项配置表示,我们会将php安装到哪里。我们就可以根据自己的喜好,规定php的存放地方。
--with-gd 和 --enable-gd-native-ttf 这两个命令是允许 gd库和一些简单的字体
--enable-mysqlnd 和 --with-mysql=mysqlnd 和 --with-pdo-mysql=mysqlnd 这三条命令,是关于,mysql的扩展操作。如果 你编译安装的是 7.*以上的版本,那么--with-mysql=mysqlnd指令可以不要。
--with-openssl开启openssl
--enable-mbstring允许mbstring
--enable-fpm 允许 php-fpm (和nginx配合,这个是重点)
输入之后,等待系统的检测吧,当你看到 Thank you for using PHP. 那么恭喜你,证明你的系统符合安装要求了。
然后输入:
make && make install
此后需要等待 几分钟。等待完毕之后,执行:
cd /usr/local/php
php-fpm这个文件,在php文件夹下的 sbin下。那么,我们来启动 php-fpm吧:
./sbin/php-fpm
然而,不幸的是,错误来了:
failed to open configuration file '/usr/local/php/etc/php-fpm.conf': No such file or directory (2)
failed to load configuration file '/usr/local/php/etc/php-fpm.conf'
FPM initialization failed
cd /usr/local/src
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar zxf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --prefix=/usr/local/nginx
这一步之后,系统会抛出一个错误:
./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.
cd /usr/local/src
wget https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.bz2
tar jxf pcre-8.38.tar.bz2
然后我们可以继续安装 nginx了,以及启动它
cd nginx-1.10.3
./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/src/pcre-8.38
make && make install
cd /usr/local/nginx
./sbin/nginx
我是在虚拟机中搭建的lnmp,此时我们通过 192.168.1.226,便可以访问我的虚拟机,然后,发现并打不开。通过ping发现,宿主机和虚拟机之间是可以互相ping通的,如果还是无法访问,一般的问题就是 防火墙屏蔽了80端口。方便起见,我们可以先关闭防火墙,当然,你一可以配置 允许80端口访问。
//1、删除不相关的用户
delete from user where Host != 'localhost';
delete from user where user = '';
//2 、改密码
update user set Password = password('root');
//3、将修改后的信息刷新到内存中
flush privileges;
//退出重新登录
exit;