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

The Operation method of compiling and installing PHP7.0.5 with CentOS 6 Source Code

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

Share

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

CentOS 6 source code compilation and installation of PHP7.0.5 operation, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Environment introduction:

System version: RHEL 6

Software repository: yum-Base,yum-Epel

PHP version: PHP 7.0.5

Installation method: source code compilation

Delete the original yum installation version php

# yum remove php- y # yum remove php-*-y

two。 Install the development package and dependent environment

# yum-y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel

3. Create a running user

# useradd-r-M-s / sbin/nologin php

4. Download the php 7 source code package, the official download page of php, http://php.net/downloads.php

# wget-O php-7.0.5.tar.gz http://cn2.php.net/get/php-7.0.5.tar.gz/from/this/mirror

5. Compile and install php 7

# tar xf php-7.0.5.tar.gz# cd php-7.0.5/#. / configure-prefix=/usr/local/php_7.0.5-- datarootdir=/usr/share-- enable-fpm-- with-fpm-user=php-- with-fpm-group=php-- with-curl-- with-mysqli=/usr/local/mysql5.6.26/bin/mysql_config-- with-mysql-sock=/var/lib/mysql/mysql.sock-- with- Readline-with-snmp-enable-soap-with-pear-with-pdo-mysql=/usr/local/mysql5.6.26

Since I have compiled and installed mysql 5.6 before, I need to specify the mysqli-related path manually

# make-j 4 & & make install

6. Test php

# / usr/local/php-7.0.5/bin/php-v

7. Configure php-fpm

Since I used php-fpm to handle back-end php requests, I need to configure php-fpm here

Enter the php source directory Copy service startup script # cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm# chmod + x / etc/init.d/php-fpm# chkconfig-- add php-fpm edits the php-fpm configuration file # cp / usr/local/php_7.0.5/etc/php-fpm.conf.default / usr/local/php_7.0.5/etc/php-fpm.conf# mv / usr/local/php_7.0.5/ Etc/php-fpm.d/www.conf.default / usr/local/php_7.0.5/etc/php-fpm.d/www.conf# service php-fpm start

8. Test whether php-mysqli can be used properly

# php-a > $db = new mysqli ('localhost',' mysql', 'root','')

If you don't report an error, then there should be no problem.

After reading the above, have you mastered the operation method of compiling and installing PHP7.0.5 in CentOS 6 source code? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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