Compile the method of installing PHP7 under openSUSE42.1,
First recommend a post PHP 7 Release Date Arrived:will developers adopt PHP 7? -PHP Classes Blog.
In terms of whether to use PHP7, personally, I do not hesitate to use, but the production environment is not my decision, so only in their own development environment to update PHP version. So, what about you?
The author uses the Linux openSUSE42.1 distribution, and YaST has no PHP7 installation package, so it can only be manually compiled and installed. As a PHP developer, I am very much want to be able to learn to compile and install PHP7, tried several times before, but each installation must be online to find all kinds of information, so, the installation after the success of their own installation process and encountered problems recorded, convenient for later access and share to the needs of people.
Download the source code and unzip
To get to the point, to compile and install PHP7, the first of course to download PHP7 source. You can go to GitHub on clone, or you can download it on the PHP website. Download and unzip to the/USR/LOCAL/SRC directory and rename the directory to PHP7. Enter the directory.
Configuring compilation parameters
Build configuration file
./buildconf
Configuration
./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 \-- Disable-rpath \--enable-shared \--enable-xml \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-mbregex \-- Enable-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-opcache \--enable-fpm \--disable-cgi \--with-fpm-user=nginx \--with-fpm-group=nginx \--without-gdbm \--dIsable-fileinfo
Parameter description
Prefix PHP7 installation root directory
With-config-file-path PHP7 's configuration file directory
After executing the above configuration command, the result is as follows:
During the execution of the above command, you will encounter some dependencies that are missing, and the dependencies I have encountered are listed below:
Error:
Configure:error:xml2-config not found. Please check your LIBXML2 installation.
Solve:
Zypper Install Libxml2-devel
Error:
Configure:WARNING:unrecognized Options:--with-mysql
Solve:
To cancel this option, this option does not exist.
Error:
Configure:error:jpeglib.h not found.
Solve:
Zypper Install Libjpeg-devel
Error:
Configure:error:mcrypt.h not found. Please reinstall Libmcrypt.
Solve:
Zypper Install Libmcrypt-devel
Error:
Checking for Recode support ... yes
Configure:error:Can not find recode.h anywhere under/usr/usr/local/usr/opt.
Solve:
Zypper Install Librecode-devel
In general, in the configuration of the time encountered without the open yast search, if you have to install, and then recompile see also need those, if not found in YaST, then go online to find Google.
Compiling and installing PHP7
Make && make install
Where make test can be selected. Just an optional step, do not know what the problem, but the author has not yet encountered.
To view the PHP7 directory after successful installation
After the compilation installation is successful, review the PHP7 installation directory ' LS/USR/LOCAL/PHP7 ':
To set the configuration file for PHP7
Cp/usr/local/src/php7/php.ini-production/usr/local/php7/etc/php.ini
cp/usr/local/src/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm
Cp/usr/local/php7/etc/php-fpm.conf.default/usr/local/php7/etc/php-fpm.conf
Cp/usr/local/php7/etc/php-fpm.d/www.conf.default/usr/local/php7/etc/php-fpm.d/www.conf
Setting environment variables
In the last line of the/etc/profile file, add
Export Path=/usr/local/php7/bin:/usr/local/php7/sbin: $PATH
Then execute Source/etc/profile
Set the PHP log directory and the PHP-FPM process files (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 up
chmod +x/etc/init.d/php-fpm
Chkconfig PHP-FPM on
You can use the Chkconfig command to view a list of boot-up services.
Start PHP Service
Service PHP-FPM Start
Via PS aux | grep ' php ' to see if PHP started successfully
At this point, PHP7 is installed successfully, you also start to use PHP7 Bar!
The above described to you on the openSUSE42.1 under the installation of PHP7 method, I hope you like.
Articles you may be interested in:
- Compiling a development environment for installing PHP7 on Mac
- PHP7.0 Installation Notes Finishing
- compiler installation and MySQL support for PHP7 under CentOS and solutions to some common problems
http://www.bkjia.com/PHPjc/1084542.html www.bkjia.com true http://www.bkjia.com/PHPjc/1084542.html techarticle under openSUSE42.1 to compile the method of installing PHP7, first recommend an article PHP 7 Release Date Arrived:will developers adopt PHP 7-php Classes Blog. It says whether or not to use ...