Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure PHP to use

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to install and configure PHP". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

On June 11, 2015, the official website of PHP released the alpha version of the first edition of PHP7.

PHP7 features:

PHP 7.0.0 Alpha 1 uses the new version of the ZendEngine engine and brings many new features. The following is an incomplete list:

(1) performance improvement: the performance of PHP7 is twice higher than that of PHP5.6. Improved performance: PHP 7 is up to twice as fast as PHP 5.6

(2) full and consistent 64-bit support. Consistent 64-bit support

(3) many fatal mistakes in the past have now been changed to throw exceptions. Many fatal errors are now Exceptions

(4) removed some old SAPI (server-side application programming ports) and extensions that are no longer supported. Removal of old and unsupported SAPIs and extensions

(5) A null join operator has been added. The null coalescing operator (?

(6) A new combination comparison operator is added. Combined comparison Operator ()

(7) the return type declaration of the function has been added. Return Type Declarations

(8) Scalar type declaration has been added. Scalar Type Declarations

(9) add anonymous class. Anonymous Classes

Collation of php7 installation notes

# install mcrypt

Yum install-y php-mcrypt libmcrypt libmcrypt-devel

# upgrade bison

Cd / var/soft/wget http://ftp.gnu.org/gnu/bison/bison-2.6.4.tar.gztar-xvzf bison-2.6.4.tar.gz cd bison-2.6.4./configuremake & & make install

# upgrade re2c to solve You will need re2c 0.13.4 or later if you want to regenerate PHP

Parsers. Error

Cd / var/soft/wget http://sourceforge.net/projects/re2c/files/re2c/0.13.5/re2c-0.13.5.tar.gz/downloadtar zxf re2c-0.13.5.tar.gz & & cd re2c-0.13.5./configuremake & & make install

Compile PHP7

# create directory mkdir-p / var/soft/php7cd / var/soft/php7# download source code git clone http://git.php.net/repository/php-src.gitcd php-src./buildconf# configuration parameters. / 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#### # solution to the / encodings.c:101: undefined reference to `libiconv_close' error when compiling and installing php # the following error occurred when installing 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 describe this as a bug (https://bugs.php.net/bug.php?id=52611) according to the official website of php. You need to manually modify the Makefile file after configure. Find EXTRA_LIBS and add-liconv at the end, and you can successfully pass # (about 104in the Makefile file) # 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-ldl -ldl-lcrypt-lxml2-lz-lm-ldl-lssl-lcrypto-lcrypt-liconv#### # compile and install make & & sudo make install

# configuration

Cp php.ini-production / usr/local/php7/etc/php.inicp sapi/fpm/init.d.php-fpm / etc/init.d/php7-fpmchmod + x / etc/init.d/php7-fpmcp / usr/local/php7/etc/php-fpm.conf.default / usr/local/php7/etc/php-fpm.confcp / usr/local/php7/etc/php-fpm.d/www.conf.default / usr/local/php7/etc/php-fpm.d/www.conf

# configure opcache

Vim / usr/local/php7/etc/php.ini# join zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/opcache.so# startup / etc/init.d/php7-fpm start

# View PHP version

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

Results:

PHP 7.0.0-dev (cli) (built: Mar 3 2015 10:02:26) Copyright (c) 1997-2015 The PHP GroupZend 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 "how to install and configure PHP" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report