yum安装PHP7

The CentOS 7 official software repositories have PHP 5.4 which has reached the end of life and no longer actively maintained by the developers.

To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system.

For the purpose of this guide, we will be operating the system as root, if that is not the case for you, make use of the sudo command to acquire root privileges.

Installing PHP 7 on CentOS 7

1. To install PHP 7, you have to install and enable EPEL and Remi repository on your CentOS 7 system with the commands below.

2. Next, you need to install yum-utils, a collection of useful programs for managing yum repositories and packages. It has tools that basically extend yum’s default features.

It can be used for managing (enabling or disabling) yum repositories as well as packages without any manual configuration and so much more.

3. One of the programs provided by yum-utils is yum-config-manager, which you can use to enable Remirepository as the default repository for installing different PHP versions as shown.

If you want to install PHP 7.1PHP 7.2 or PHP 7.3 on CentOS 7, just enable it as shown.

4. Now install PHP 7 with all necessary modules with the command below.

Afterwards, double check the installed version of PHP on your system.

Check PHP Version in CentOS 7

Check PHP Version in CentOS 7

 

【原文:】https://www.tecmint.com/install-php-7-in-centos-7/

php7中使用正则判断邮箱、IP格式是否正确

判断IP:

判断邮箱:

备注:

在PHP7中,以下函数被废弃:

  • ereg
  • mysql
  • mssql
  • sybase_ct

【参考:http://blog.csdn.net/Katniss_smile/article/details/52615191】

php7的mongodb扩展

配置:

  1. 将下载的php_mongodb.dll放入php环境的ext目录中
  2. 修改php环境目录中的php.ini文件,apache环境目录中的php.ini文件,新增以下扩展

    备注:

扩展下载:php_mongodb

检查是否成功:查看phpinfo信息中是否有mongodb信息