Table of Contents
[Install PHP] How to compile and install PHP7 under openSUSE42.1, opensuse42.1php7
Download the source code and unzip it
Configure compilation parameters
Generate configuration file
Configuration
Compile and install PHP7
View the PHP7 directory after successful installation
Set up PHP7 configuration file
Set environment variables
Set the PHP log directory and php-fpm process file (php-fpm.sock) directory
Set PHP to start at boot
Start PHP service
Home Backend Development PHP Tutorial [Installing PHP] How to compile and install PHP7 under openSUSE42.1, opensuse42.1php7_PHP tutorial

[Installing PHP] How to compile and install PHP7 under openSUSE42.1, opensuse42.1php7_PHP tutorial

Jul 12, 2016 am 09:03 AM
php php7 Down Install compile

[Install PHP] How to compile and install PHP7 under openSUSE42.1, opensuse42.1php7

First recommend an article PHP 7 Release Date Arrived: Will Developers Adopt PHP 7? - PHP Classes blog.

It talks about whether I will use PHP7. Personally, I will use it without hesitation, but I don’t have the final say in the production environment, so I can only update the PHP version in my own development environment. . So, what about you?

The author is using the openSUSE42.1 distribution of Linux. There is no installation package for PHP7 in Yast, so I can only compile and install it manually. As a PHP developer, I really hope to learn how to compile and install PHP7. I have tried it several times before, but every time I install it, I have to go online to find various information. So, after the successful installation this time, I want to go through my own installation process. And record the problems encountered so that you can refer to them later and share them with those who need them.

Download the source code and unzip it

Getting to the point, to compile and install PHP7, you must first download the source code of PHP7. You can clone it on github or download it from the PHP official website. After downloading, extract it to the /usr/local/src directory and rename the directory to php7. Enter the directory.

Configure compilation parameters

Generate configuration file

./buildconf
Copy after login

Configuration

./<span>configure \
</span>--prefix=/usr/local/<span>php7 \
</span>--exec-prefix=/usr/local/<span>php7 \
</span>--bindir=/usr/local/php7/<span>bin \
</span>--sbindir=/usr/local/php7/<span>sbin \
</span>--includedir=/usr/local/php7/<span>include \
</span>--libdir=/usr/local/php7/lib/<span>php \
</span>--mandir=/usr/local/php7/php/<span>man</span><span> \
</span>--with-config-<span>file</span>-path=/usr/local/php7/<span>etc \
</span>--with-mysql-sock=/var/run/mysql/<span>mysql.sock \
</span>--with-mcrypt=/usr/<span>include \
</span>--with-<span>mhash \
</span>--with-<span>openssl \
</span>--with-mysqli=<span>shared,mysqlnd \
</span>--with-pdo-mysql=<span>shared,mysqlnd \
</span>--with-<span>gd \
</span>--with-<span>iconv \
</span>--with-<span>zlib \
</span>--enable-<span>zip</span><span> \
</span>--enable-inline-<span>optimization \
</span>--disable-<span>debug \
</span>--disable-<span>rpath \
</span>--enable-<span>shared \
</span>--enable-<span>xml \
</span>--enable-<span>bcmath \
</span>--enable-<span>shmop \
</span>--enable-<span>sysvsem \
</span>--enable-<span>mbregex \
</span>--enable-<span>mbstring \
</span>--enable-<span>ftp</span><span> \
</span>--enable-gd-native-<span>ttf \
</span>--enable-<span>pcntl \
</span>--enable-<span>sockets \
</span>--with-<span>xmlrpc \
</span>--enable-<span>soap \
</span>--without-<span>pear \
</span>--with-<span>gettext \
</span>--enable-<span>session \
</span>--with-<span>curl \
</span>--with-jpeg-<span>dir</span><span> \
</span>--with-freetype-<span>dir</span><span> \
</span>--enable-<span>opcache \
</span>--enable-<span>fpm \
</span>--disable-<span>cgi \
</span>--with-fpm-user=<span>nginx \
</span>--with-fpm-group=<span>nginx \
</span>--without-<span>gdbm \
</span>--disable-fileinfo
Copy after login

Parameter description

<p>prefix PHP7安装的根目录</p>
<p><em id="__mceDel">with-config-file-path PHP7的配置文件目录</em></p>
Copy after login

The result after executing the above configuration command is as shown below:

When executing the above command, you will encounter some prompts about missing dependencies. The dependency problems I encountered are listed below:

Error:

configure: error: xml2-config not found. Please check your libxml2 installation.
Copy after login

Solution:

zypper <span>install</span> libxml2-devel
Copy after login

Error:

configure: WARNING: unrecognized options: --with-mysql
Copy after login

Solution:

取消这个选项,这个选项是不存在的
Copy after login

Error:

configure: error: jpeglib.h not found.
Copy after login

Solution:

zypper <span>install</span> libjpeg-devel
Copy after login

Error:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Copy after login

Solution:

zypper <span>install</span> libmcrypt-devel
Copy after login

Error:

checking <span>for</span><span> recode support... yes
configure: error: Can not </span><span>find</span> recode.h anywhere under /usr /usr/local /usr /opt.
Copy after login

Solution:

zypper <span>install</span> librecode-devel
Copy after login

In general, when configuring, if you encounter something that is not available, open Yast and search for it. If it exists, install it, and then recompile to see what else is needed. If you can’t find it in Yast, then search online on Google .

Compile and install PHP7

<span>make</span> && <span>make</span> <span>install</span>
Copy after login
<p>其中,make之后可以选择make test。只是一个可选步骤,不执行不知道有什么问题,不过笔者暂时还没遇到。</p>
Copy after login

View the PHP7 directory after successful installation

After successful compilation and installation, check the PHP7 installation directory `ls /usr/local/php7`:

Set up PHP7 configuration file

<span>cp</span> /usr/local/src/php7/php.ini-production /usr/local/php7/etc/<span>php.ini
</span><span>cp</span> /usr/local/src/sapi/fpm/init.d.php-fpm /etc/init.d/php-<span>fpm
</span><span>cp</span> /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-<span>fpm.conf
</span><span>cp</span> /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
Copy after login

Set environment variables

Add

to the last line of the /etc/profile file
export PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH
Copy after login


Then execute source /etc/profile

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

<span>mkdir</span> -p /var/log/php-fpm/ && <span>mkdir</span> -p /var/run/php-fpm && cd /var/run/ && <span>chown</span> -R nginx:nginx php-fpm
Copy after login

Set PHP to start at boot

<span>chmod</span> +x /etc/init.d/php-<span>fpm
chkconfig php</span>-fpm on
Copy after login
<p>可以用chkconfig命令查看开机启动服务列表。</p>
Copy after login

Start PHP service

service php-fpm start
Copy after login

Check whether PHP is started successfully through ps aux | grep 'php'

At this point, PHP7 has been installed successfully, and you can start using PHP7!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1083559.htmlTechArticle[Install PHP] How to compile and install PHP7 under openSUSE42.1, opensuse42.1php7 First recommend an article PHP 7 Release Date Arrived: Will Developers Adopt PHP 7? - PHP Classes blog. Inside...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

Explain the match expression (PHP 8 ) and how it differs from switch. Explain the match expression (PHP 8 ) and how it differs from switch. Apr 06, 2025 am 12:03 AM

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

See all articles