To compile the PHP7 method _php instance under openSUSE42.1

Source: Internet
Author: User
Tags fpm mcrypt mkdir php website recode

First recommend an article PHP 7 release Date Arrived:will developers adopt PHP 7? -PHP Classes Blog.

Inside said whether will go to use PHP7, personally, I do not hesitate to use, but the production environment is not my decision, so can only own in their own development environment update PHP version. So, what about you?

The author is using Linux openSUSE42.1 distribution, yast inside there is no PHP7 installation package, so you can only manually compile the installation. As a PHP developer, I am very want to be able to learn to compile and install PHP7, tried a few times before, but each installation must surf the Internet to find all kinds of information, so, the installation after the successful want to install their own process and the problems encountered to record, convenient to consult and share to the needs of the people.

Download source and Unzip

To get to the point, to compile and install PHP7, first of course to download the PHP7 source. You can go to GitHub on clone, also can go to PHP website download. Extract to the/USR/LOCAL/SRC directory after downloading and rename the directory to PHP7. Enter the directory.

Configuring compilation parameters

Build configuration file



./configure \--prefix=/usr/local/php7 \--exec-prefix=/usr/local/php7 \--bindir=/usr/local/php7/bin \--SBINDIR=/USR /local/php7/sbin \--includedir=/usr/local/php7/include \--libdir=/usr/local/php7/lib/php \--mandir=/usr/local/ Php7/php/man \--with-config-file-path=/usr/local/php7/etc \--with-mysql-sock=/var/run/mysql/mysql.sock \-- With-mcrypt=/usr/include \--with-mhash \--with-openssl \--with-mysqli=shared,mysqlnd \--with-pdo-mysql=shared, MYSQLND \--with-gd \--with-iconv \--with-zlib \--enable-zip \--enable-inline-optimization \--disable-debug \--disab Le-rpath \--enable-shared \--enable-xml \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-mbregex \--ena 
ble-mbstring \--enable-ftp \--enable-gd-native-ttf \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-soap \ --without-pear \--with-gettext \--enable-session \--with-curl \--with-jpeg-dir \--with-freetype-dir \--ENABLE-OPCAC He \--enable-fpm \--disable-cgi \--with-fpm-user=nginx \--with-fpm-group=nginx \--without-gdbm \--disable-fileinfo  

Parameter description

root directory of prefix PHP7 installation

With-config-file-path PHP7 configuration file directory

The results of the above configuration command are shown in the following illustration:

There are some missing hints that are encountered during the execution of the above command, and the following list of dependencies I have encountered:


Configure:error:xml2-config not found. Please check your LIBXML2 installation.


Zypper Install Libxml2-devel


Configure:WARNING:unrecognized Options:--with-mysql


Cancel this option, this option is not present


Configure:error:jpeglib.h not found.


Zypper Install Libjpeg-devel


Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.


Zypper Install Libmcrypt-devel


Checking for Recode support ... yes
Configure:error:Can not find recode.h anywhere under/usr/usr/local/usr/opt.


Zypper Install Librecode-devel

In general, when the configuration of the encounter did not open YaST search, if there are some words on the installation, and then recompile see also need those, if the yast can not find, then the Internet to find Google.

Compiling and installing PHP7

Make && make install

In which you can choose make test. Just an optional step, do not do not know what the problem, but the author has not met for the time being.

View the PHP7 directory after a successful installation

After compiling the installation successfully, view the PHP7 installation directory ' LS/USR/LOCAL/PHP7 ':

Set up a PHP7 configuration file


Setting environment variables

On the last line of the/etc/profile file, add

Export Path=/usr/local/php7/bin:/usr/local/php7/sbin: $PATH

Then execute the Source/etc/profile

Set up the PHP log directory and the PHP-FPM process file (php-fpm.sock) directory

Mkdir-p/var/log/php-fpm/&& mkdir-p/var/run/php-fpm && cd/var/run/&& chown-r nginx:nginx ph p-fpm

Set PHP to boot

chmod +x/etc/init.d/php-fpm
Chkconfig PHP-FPM on

You can use the Chkconfig command to view the Startup services list.

Start the PHP service

Service PHP-FPM Start

Through PS aux | grep ' php ' to see if PHP started successfully

At this point, PHP7 installed successfully, you also began to use PHP7 Bar!

The above mentioned to everyone in the openSUSE42.1 to compile and install the PHP7 method, I hope you like.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.