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 php 5.6.15

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to install php 5.6.15, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Php5.6.15 installation method: 1, prepare installation files; 2, prepare installation environment and necessary packages; 3, through "cd php-5.6.15. / configure-- prefix=/usr/local/php5615..." Command to install PHP;4 and configure fpm service.

This article operating environment: windows7 system, php version 5.6.15, DELL G3 computer

How to install php 5.6.15?

PHP 5.6.15 compilation and installation

1. Prepare the installation files

Php-5.6.15.tar http://php.net/downloads.php

two。 Prepare the installation environment and the necessary packages

Yum install-y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel yum install gcc gcc-c++ # compilation tool if you want the compiled php to support mcrypt extensions, you need to install libmcrypt libmcrypt-devel or compile and install tar-zxvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7. / configure make & & make install

3. Installation

Cd php-5.6.15. / configure-- prefix=/usr/local/php5615-- with-config-file-path=/usr/local/php5615/etc-- enable-fpm-- with-fpm-user=php-fpm-- enable-mysqlnd-- with-mysql=mysqlnd-- with-mysqli=mysqlnd-- with-pdo-mysql=mysqlnd-- enable-opcache-- enable-mbstring-- enable-soap-- enable-zip-- enable-bcmath-- with-openssl-- with-zlib-- with-curl -with-gd-- with-zlib-dir=/usr/lib-- with-png-dir=/usr/lib-- with-jpeg-dir=/usr/lib-- with-mhash-- with-apxs2=/usr/local/apache/bin/apxs

Note that the last line points to the apxs location. If you don't know, look for the find /-name "apxs", so that the php will not be born until it is compiled.

It becomes libphp5.so for apache to call. If the system is not installed, you can install it through yum-y install httpd-devel

The first line is the installation location. I installed it in the / usr/local/php5615 directory. I can change it myself and then make & & make install

4. Subsequent configuration

(a). Configure the php-fpm service

In previous versions of php5.3.3, php-fpm exists in the form of a fix pack, while post-php5.3.3 php-fpm only needs to be used when installing php-fpm-enable-fpm to turn on this feature.

After the compilation and installation is complete, you need to copy the php-fpm.conf.default configuration sample file in the installed etc directory and rename it as a configuration file.

(B). Add system Startup Service

Enter the installation source file directory

Cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm56chmod+x / etc/init.d/php-fpm56chkconfig-- add php-fpm56service php-fpm56 startss-tnl

We can clearly see that php-fpm has started normally.

Note that php-fpm listens on port 9000 by default.

(C). Php.ini profile

Copy the php.ini-production under the source directory to the configuration file directory / usr/local/php5615/etc specified at compile time, and rename it

Is php.ini (the default path for php.ini can also be viewed by writing an index.php file and viewing it with phpinfo ())

4. Combination of php and apache

Modify the http.conf configuration file for apache

(a) join LoadModulephp5_module modules/libphp5.so

Pay attention to check whether the line already exists in the configuration file. If it is repeated, an error will be reported.

(B) add the following two lines

AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps

Or

Using apache's FilesMatch

EtHandlerapplication/x-httpd-php

If you want files ending with .php, .php2, .php3, .php4, .php5, .php6, .phtml to make apache

To execute as php, you can write:

SetHandlerapplication/x-httpd-php

(C) navigate to DirectoryIndex index.html

Modified to: DirectoryIndex index.php index.html

5. test

Restart the httpd service, write an index.php to see the effect with phpinfo (), and test the database connection by the way. If everything is normal, you can see the php message.

6. Combination of php and Nginx

If php and nginx are not on the same machine, change the client listening address and port in the php configuration file to allow nginx access

Vim / usr/local/php/etc/php-fpm.conf listen=192.168.61.161:9000

Configure nginx to support php, as follows:

Location ~\ .php$ {root html; fastcgi_pass 127.0.0.1 root html; fastcgi_pass 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}

Then create a new index.php file test in the root directory of the nginx website, as follows:

Vim / usr/local/nginx/html/index.php

It is normal that the details of php can be displayed.

7. Description of some installation parameters of php

"installation path"--prefix=/usr/local/php56" php.ini profile path "--with-config-file-path=/usr/local/php56/etc" Optimization options "--enable-inline-optimization-- disable-debug-- disable-rpath-- enable-shared"enable opcache Default is ZendOptimizer+ (ZendOpcache) "--enable-opcache" FPM ""-- enable-fpm enables php's fastcgi function, that is, enable php-fpm function-- with-fpm-user=www-- with-fpm-group=www "MySQL"-- with-mysql=mysqlnd-- with-mysqli=mysqlnd-- with-pdo-mysql=mysqlnd "," internationalization and character encoding support "--with-gettext-- the main function of the enable-mbstring mbstring module is to detect and convert codes. Provides a string function for the corresponding multibyte operation. -- with-iconv "encryption extension"--with-mcrypt-- with-mhash-- with-openssl" Mathematical extension ""-- enable-bcmath "Web service, soap relies on libxml"--enable-soap\-- with-libxml-dir\" process Signal and memory ""-- enable-pcntl\-- enable-shmop\-- enable-sysvmsg\-- enable-sysvsem\-- enable-sysvshm\ "socket & curl"-- enable-sockets\-- with-curl\ "Compression and archiving"--with-zlib\-- enable-zip\-- with-bz2\" GNU Readline Command Line Shortcut binding ""-- with-readline

On how to install php 5.6.15 to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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