Home Backend Development PHP Tutorial PHP7.0安装笔记整理_PHP

PHP7.0安装笔记整理_PHP

May 30, 2016 am 08:44 AM

2015年6月11日,PHP官网发布消息,正式公开发布PHP7第一版的alpha版本.

PHP7特性:

PHP 7.0.0 Alpha 1使用新版的ZendEngine引擎,带来了许多新的特性,以下是不完全列表:

(1)性能提升:PHP7比PHP5.6性能提升了两倍。 Improved performance: PHP 7 is up to twice as fast as PHP 5.6

(2)全面一致的64位支持。 Consistent 64-bit support

(3)以前的许多致命错误,现在改成抛出异常。Many fatal errors are now Exceptions

(4)移除了一些老的不在支持的SAPI(服务器端应用编程端口)和扩展。Removal of old and unsupported SAPIs and extensions

(5)新增了空接合操作符。The null coalescing operator (??)

(6)新增加了结合比较运算符。Combined comparison Operator ()

(7)新增加了函数的返回类型声明。Return Type Declarations

(8)新增加了标量类型声明。Scalar Type Declarations

(9)新增加匿名类。Anonymous Classes

php7安装笔记整理

# 安装mcrypt

1

yum install -y php-mcrypt libmcrypt libmcrypt-devel

Copy after login

# 升级bison

1

2

3

4

5

6

cd /var/soft/

wget http://ftp.gnu.org/gnu/bison/bison-2.6.4.tar.gz

tar -xvzf bison-2.6.4.tar.gz

cd bison-2.6.4

./configure

make && make install

Copy after login

# 升级re2c,解决You will need re2c 0.13.4 or later if you want to regenerate PHP

parsers.错误

1

2

3

4

5

cd /var/soft/

wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/download

tar zxf re2c-0.13.5.tar.gz && cd re2c-0.13.5

./configure

make && make install

Copy after login

编译PHP7

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

# 创建目录

mkdir -p /var/soft/php7

cd /var/soft/php7

# 下载源代码

git clone http://git.php.net/repository/php-src.git

cd php-src

./buildconf

# 配置参数

./configure --prefix=/usr/local/php7 \

--with-config-file-path=/usr/local/php7/etc \

--with-mcrypt=/usr/include \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-gd \

--with-iconv \

--with-zlib \

--enable-xml \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--enable-mbregex \

--enable-fpm \

--enable-mbstring \

--enable-ftp \

--enable-gd-native-ttf \

--with-openssl \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--without-pear \

--with-gettext \

--enable-session \

--with-curl \

--with-jpeg-dir \

--with-freetype-dir \

--enable-opcache

#################################################################################

# 编译安装php时出现 /encodings.c:101: undefined reference to `libiconv_close' 错误的解决方法

# 在装php时出现以下的错误:

# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv_open'

# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:81: undefined reference to `libiconv'

# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'

# /root/Downloads/php-5.6.5/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close'

# collect2: error: ld returned 1 exit status

# make: *** [sapi/cli/php] Error 1

# 根据php官网描述这是一个bug(https://bugs.php.net/bug.php?id=52611)。在configure以后要手动修改下Makefile文件,找到EXTRA_LIBS 在最后添加 -liconv 即可顺利通过

# (大约在Makefile文件的104)

# EXTRA_LIBS = -lcrypt -lz -lresolv -lcrypt -lrt -lmysqlclient -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcurl -lxml2 -lz -lm -ldl -lfreetype -lmysqlclient -lz -lm -lssl -lcrypto -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcrypt -liconv

#################################################################################

# 编译安装

make && sudo make install

Copy after login

# 配置

1

2

3

4

5

cp php.ini-production /usr/local/php7/etc/php.ini

cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm

chmod +x /etc/init.d/php7-fpm

cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf

cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

Copy after login

# 配置opcache

1

2

3

4

5

vim /usr/local/php7/etc/php.ini

# 加入

zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/opcache.so

# 启动

/etc/init.d/php7-fpm start

Copy after login

# 查看PHP版本

1

/usr/local/php7/bin/php -v

Copy after login

结果:

1

2

3

4

PHP 7.0.0-dev (cli) (built: Mar 3 2015 10:02:26)

Copyright (c) 1997-2015 The PHP Group

Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies

  with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

Copy after login

以上就是本文给大家分享的PHP7.0 安装笔记整理,希望对大家有所帮助。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1671
14
PHP Tutorial
1276
29
C# Tutorial
1256
24
Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

How does PHP type hinting work, including scalar types, return types, union types, and nullable types? How does PHP type hinting work, including scalar types, return types, union types, and nullable types? Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

How do you prevent SQL Injection in PHP? (Prepared statements, PDO) How do you prevent SQL Injection in PHP? (Prepared statements, PDO) Apr 15, 2025 am 12:15 AM

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles