This article is the original work of Diandian Xiaoyu, no reproduction is allowed
Foreword
After completing the basic configuration, we can run the php environment directly on nginx, then the next thing to do is some subsequent operations
Configure the network card
Since the current Internet access method has changed from allocating fixed IP to automatic allocation, the network card configuration needs to be modified again
View the virtual machine configuration. The virtual machine uses this one on the Mac
Then modify the network card configuration file to the corresponding mac address and dhcp
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth1 HWADDR=00:1C:42:29:8E:5B TYPE=Ethernet #UUID=6bfb6ea6-4db0-483c-8964-593fea939a82 ONBOOT=yes #NM_CONTROLLED=yes BOOTPROTO=dhcp IPV6INT=yes IPV6_AUTOCONF=yes
Restart the network service, check the ip
[root@localhost ~]# service network restart 正在关闭接口 eth0: [确定] 关闭环回接口: [确定] 弹出环回接口: [确定] 弹出界面 eth0: 正在决定 eth1 的 IP 信息...完成。 [确定] [root@localhost ~]# ifconfig eth1 Link encap:Ethernet HWaddr 00:1C:42:29:8E:5B inet addr:192.168.199.143 Bcast:192.168.199.255 Mask:255.255.255.0 inet6 addr: fe80::21c:42ff:fe29:8e5b/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:355362 errors:0 dropped:0 overruns:0 frame:0 TX packets:75013 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:81823948 (78.0 MiB) TX bytes:11663119 (11.1 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:578 errors:0 dropped:0 overruns:0 frame:0 TX packets:578 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:629817 (615.0 KiB) TX bytes:629817 (615.0 KiB)
Complete, and then use this IP for ssh operations
Install PHP extension
The following part first needs to install the PHP extension. You can refer to my previous article on installing yar, but I won’t read my previous article this time. After all, I now use centos
PHP official website
http://php.net/manual/zh/book.yar.phpWe based it on Installation according to the recommended method on the official website
http://pecl.php.net/package/yar
Msgpack
Install php-devel
[root@localhost ~]# yum install php-devel
Install msgpack
[root@localhost ~]# yum install gcc cc [root@localhost ~]# pecl channel-update pecl.php.net [root@localhost ~]# pecl install channel://pecl.php.net/msgpack-0.5.5 Build process completed successfully Installing '/usr/lib64/php/modules/msgpack.so' Installing '/usr/include/php/ext/msgpack/php_msgpack.h' install ok: channel://pecl.php.net/msgpack-0.5.5 configuration option "php_ini" is not set to php.ini location You should add "extension=msgpack.so" to php.ini
Modify php.ini
[root@localhost ~]# vim /etc/php.ini #写入扩展so [root@localhost ~]# service php-fpm restart 停止 php-fpm: [确定] 正在启动 php-fpm: [确定]
Yar
[root@localhost ~]# pecl install yar configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/ [root@localhost ~]# yum install libcurl [root@localhost ~]# yum install wget </curl-dir>
re2c
[root@localhost ~]# wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download [root@localhost ~]# tar zxf download [root@localhost ~]# cd re2c-0.13.5 [root@localhost re2c-0.13.5]# yum install bison [root@localhost re2c-0.13.5]# yum install gcc gcc-c++ gcc-g77 [root@localhost re2c-0.13.5]# make && make install
Reinstall curl
[root@localhost ~]# yum install curl-devel
Installation completed
[root@localhost ~]# pecl install yar Build process completed successfully Installing '/usr/lib64/php/modules/yar.so' install ok: channel://pecl.php.net/yar-1.2.4 configuration option "php_ini" is not set to php.ini location You should add "extension=yar.so" to php.ini
php.ini
[root@localhost ~]# service php-fpm restart 停止 php-fpm: [确定] 正在启动 php-fpm:[28-Dec-2014 21:27:16] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/yar.so' - /usr/lib64/php/modules/yar.so: undefined symbol: php_json_encode in Unknown on line 0 [确定]I have encountered this problem before. It means that json needs to be loaded before loading yar, but json is not loaded at this time. Continue to modify php.ini.
[root@localhost ~]# service php-fpm restart 停止 php-fpm: [确定] 正在启动 php-fpm:[28-Dec-2014 21:29:40] NOTICE: PHP message: PHP Warning: Module 'json' already loaded in Unknown on line 0 [确定]
This means that json has been loaded, so there is no need to load it, so we remove the second loading part
[root@localhost php.d]# vi /etc/php.d/json.ini ; Enable json extension module ;extension=json.so
Restart php-fpm
[root@localhost php.d]# service php-fpm restart 停止 php-fpm: [确定] 正在启动 php-fpm: [确定]
Complete
Postscript
The php configuration under Nginx is now complete. Next is the detailed configuration of Nginx.
yar does not support mac, so sad.
Come on~
The above introduces the subsequent configuration of [Nginx] in the LNMP environment, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Chinese version
Chinese version, very easy to use

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)
