search
HomeBackend DevelopmentPHP7How to install php7 and install memcache extension. What should I do if there are compatibility issues between old and new php versions?

I don’t know if you will install php7, and I don’t know if you will deal with the compatibility issues between old and new php versions when installing the memcache extension. Today I will take you through it, and you can refer to it if you need it.

How to install php7 and install memcache extension. What should I do if there are compatibility issues between old and new php versions?

http://php.net/downloads.php

Install php-7.0.0

First install the dependent program if it is already If you have installed it, please skip it

yum install -y php-mcrypt libmcrypt libmcrypt-devel
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel
#openssl-devel是64位 如果是32位服务器请选择i386版的
yum install openssl-devel.x86_64
yum install curl curl-devel
yum -y install libxslt-devel
yum install -y php-mcrypt libmcrypt libmcrypt-devel mcrypt mhash
./configure --prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-config-file-scan-dir=/usr/local/php7/etc/php.d \
--with-mcrypt \
--enable-mysqlnd \
--with-mysqli \
--with-pdo-mysql \
--enable-fpm \
--with-gd \
--with-iconv \
--with-zlib \
--enable-xml \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--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

make &&  make install

可选
--with-fpm-user=www \
--with-fpm-group=www \

If you are prompted configure: error: mcrypt.h not found. Please reinstall libmcrypt.

Because the default yum source of centos6.x does not have the libmcrypt-devel package. Due to copyright reasons, you can only use third-party yum sources, or manually download and compile the installation package yourself

wget http://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
./configure
make && make install

If checking for C compiler default output file name... configure: error: C compiler

cannot create executables

yum list | grep c++
yum install gcc-c++.x86_64

If you are prompted with undefined reference to `libiconv', you need to install libiconv first

--with-iconv=/usr/local/libiconv

If you still get an error, vim Makefile

Find EXTRA_LIBS =

Add -liconv

at the end or directly make ZEND_EXTRA_LIBS='-liconv'

If you reinstall an old version of php, you need to recompile apache's LoadModule php5_module file

./configure --with-apxs2=/usr/local/sbin/apxs

At this point, the php7 installation is completed

mv /usr/local/src/php-7.1.0/php.ini-production /usr/local/php7/etc/php.ini

Enable php-fpm service

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

Be careful to change the user and group of php-fpm.conf, otherwise File not found may be reported due to permission issues.

user = nobody
group = nobody

Run php-fpm

/usr/local/php7/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7/etc/php-fpm.conf

If you want to use this command service php-fpm start|stop|restart

cd /usr/local/src/php-7.1.0/sapi/fpm
ls
cp init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on

you can use service php-fpm start to enable php- fpm. Use ps -ef | grep php-fpm to check the process.

But when I install the memcache extension

http://pecl.php.net/package/memcache

Install memcache-2.2.7 2012 stable version

#如果已安装过autoconf请忽略
autoconf
yum install autoconf

phpize
./configure --enable-memcache --with-php-config=/usr/local/php7/bin/php-config
make && make install

Fatal error reported at this time /root/memcache-2.2.7/memcache.c:40:40: fatal error: ext/standard/php_smart_str.h: No such file or directory

The php_smart_str.h file does not exist

Baidu search php_smart_string.h is to dynamically apply for memory space for string preprocessing. It is similar to the allocation of memory in pages in the operating system. Its advantage is to align memory addresses and improve access. speed.

I found that php7 has changed this file to php_smart_string.h. Comparing the two files, the changes are quite large.

I don’t know if this is because the compatibility of the official PHP development team has not been improved

Recommended learning: php video tutorial

The above is the detailed content of How to install php7 and install memcache extension. What should I do if there are compatibility issues between old and new php versions?. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.