Home > Article > Backend Development > Install php5.6.32 under ubuntu to complete the php environment setup method
This article mainly shares with you the installation process of php5.6.32. As of now, the latest official version is php7.1.12. Most website operating environments still use the php5.6 version. I want to play with it. The php7 version can be downloaded from the official website: http://php.net/downloads.php
The installation process is as follows:
1. Enter the temporary directory
The code is as follows
# cd /data/tmp
2. Download php5.6.32
The code is as follows
# wget http://php.net/get/php-5.6.32.tar.gz
3. Unzip
The code is as follows
# tar -zxvf php-5.6.32.tar.gz
4. Enter the php directory
The code is as follows
# cd php-5.6.32
5. Configure the software installation directory and other dependent packages
The code is as follows
# ./configure --prefix=/data/webserver/php--with-config-file-path=/data/webserver/php/etc --enable-intl --disable-rpath - -enable-shared --enable-opcache --enable-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with -iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable -sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-gd --with-freetype-dir --with-jpeg-dir --with- png-dir --with-libxml-dir
6. When executing step 5, various errors will be prompted on the last line. Search Baidu based on the errors, and then install various dependency packages. This is more time-consuming. After each dependent package is installed, perform step 5 again until no errors are reported. If the operating system lacks too many dependency packages, just be patient and wait patiently!
7. Installation
The code is as follows
# make && make install
8.Prompt message for successful installation
[PEAR] Archive_Tar - installed: 1.3.12
[PEAR] Console_Getopt - installed : 1.3.1
[PEAR] Structures_Graph-installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.3
[PEAR] PEAR - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/usr/local/php/ build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/ phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
9. PHP configuration
php.ini is the PHP running core configuration file
php-fpm.conf is the configuration file of php-fpm process service
The code is as follows
# cp php.ini-production /data/webserver/php/etc/php.ini
# cp /data/ webserver/php/etc/php-fpm.conf.default /data/webserver/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/ php-fpm
# chmod +x /etc/init.d/php-fpm
10. fpm test php configuration
The code is as follows
# /data/webserver/php/sbin/php-fpm -t
Tip:
[23-May-2016 20:03:52] NOTICE:
configuration file /data/webserver/php/etc/php-fpm.conf test is successful
11. Modify the user and user group for running the php service
The code is as follows
# vi /data/webserver/php/etc/php-fpm.conf
Find in php-fpm.conf Change user=nobody
user=nobody
group=nobody
to
user = www
group = www
12. Start, restart, and stop php Service
The code is as follows
#Start
# /etc/init.d/php-fpm start
# Tip: Starting php-fpm done
#Restart
# /etc/init .d/php-fpm reload
# Tip: Reload service php-fpm done
#Stop
# /etc/init.d/php-fpm stop
# Tip: Gracefully shutting down php- fpm done
The above is the detailed content of Install php5.6.32 under ubuntu to complete the php environment setup method. For more information, please follow other related articles on the PHP Chinese website!