Home Backend Development PHP Problem php5.5 installation tutorial

php5.5 installation tutorial

Aug 17, 2020 am 10:01 AM

php5.5 installation method: first download the PHP source code package; then add the epel source and create a www user; then compile through commands such as "cd /usr/local/src/php-5.5.15/" Install; finally modify the corresponding configuration file.

php5.5 installation tutorial

Recommended: "PHP Video Tutorial"

php5.5 Compilation and Installation

System environment: centos6.5

PHP package: 5.5.15

1

https://wiki.swoole.com/wiki/page/177.html

Copy after login

Download PHP source code package

1

2

3

4

5

6

wget http://cn2.php.net/distributions/php-5.5.15.tar.bz2

tar xf php-5.5.15.tar.bz2 -C /usr/local/src/

配置文件:     /usr/local/php/etc/php-fpm.conf

配置pid:    /var/run/php-fpm/php-fpm.pid

错误日志:error_log=/var/log/php-fpm.log

            /etc/php.ini

Copy after login

Add epel source

1

2

3

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel

openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel

Copy after login

Create www user

1

2

groupadd www

useradd -g www -s /sbin/nologin -M www

Copy after login

Compile and install

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

cd /usr/local/src/php-5.5.15/

./configure \

--prefix=/usr/local/php \

--with-config-file-path=/etc \

--enable-inline-optimization \

--disable-debug \

--disable-rpath \

--enable-shared \

--enable-opcache \

--enable-fpm \

--with-fpm-user=www \

--with-fpm-group=www \

--with-mysql=/usr/local/mysql \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-gettext \

--enable-mbstring \

--with-iconv \

--with-mcrypt \

--with-mhash \

--with-openssl \

--enable-bcmath \

--enable-soap \

--with-libxml-dir \

--enable-pcntl \

--enable-shmop \

--enable-sysvmsg \

--enable-sysvsem \

--enable-sysvshm \

--enable-sockets \

--with-curl \

--with-zlib \

--enable-zip \

--with-bz2 \

--with-readline \

--without-sqlite3 \

--without-pdo-sqlite \

--with-pear

Copy after login

Your Web Server

uses Apache. Please add something like:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

--with-apxs2=/usr/local/apache/bin/apxs 参数

--prefix=/usr/local/php \            安装路径

--with-config-file-path=/etc \        php.ini配置文件路径

--enable-inline-optimization \        优化项

--disable-debug \

--disable-rpath \

--enable-shared \

--enable-opcache \                    启用 opcache,默认为 ZendOptimizer+(ZendOpcache)

--enable-fpm \                        FPM

--with-fpm-user=www \

--with-fpm-group=www \

--with-mysql=mysqlnd \                 MySQL

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-gettext \                    国际化与字符编码支持

--enable-mbstring \

--with-iconv \

--with-mcrypt \                        加密扩展

--with-mhash \

--with-openssl \

--enable-bcmath \                    数学扩展

--enable-soap \                         Web 服务,soap 依赖 libxml

--with-libxml-dir \

--enable-pcntl \                    进程,信号及内存

--enable-shmop \

--enable-sysvmsg \

--enable-sysvsem \

--enable-sysvshm \

--enable-sockets \                    socket & curl

--with-curl \

--with-zlib \                        压缩与归档

--enable-zip \

--with-bz2 \

--with-readline \                    GNU Readline 命令行快捷键绑定

--without-sqlite3 \

--without-pdo-sqlite \

--with-pear                            更多 PHP 扩展与应用库

Copy after login

Compile and install

1

2

make -j4

make install

Copy after login

Reinstall:

1

2

3

4

5

# make clean

# make clean all

# ./configure ...

# make -j4

# make install

Copy after login

Configure PHP

Configuration file

1

# cp php.ini-development /etc/php.ini

Copy after login

php-fpm service

1

2

3

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

# chmod +x /etc/init.d/php-fpm

Copy after login

Start php-fpm

1

2

3

4

# service php-fpm start

Starting php-fpm  done

vi ~/.bash_profile

PATH=$PATH:$HOME/bin

Copy after login

Change to:

1

PATH=$PATH:$HOME/bin:/usr/local/php/bin

Copy after login

Enable PHP environment variables to take effect: # . ~/.bash_profile

Check the PHP version: php -v

Settings Auto-start at boot

1

echo service php-fpm start >> /etc/rc.local

Copy after login

rc.local may also appear in the directory of /etc/init.d

Add yum source

CentOS 6.x source

1

2

# rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Copy after login

Install PHP

1

2

3

4

# yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel

php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug

php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process

php-gd php-common

Copy after login

Install the 5.6 version as remi-php56, and install the 5.5 version as remi-php55

How to configure php-fpm as a service in Linux

1. Configure php-fpm.conf

1

vi /usr/local/php/etc/php-fpm.conf

Copy after login

php-fpm.pid directory must point to: /usr/local/php/var/run/php-fpm.pid

2. Copy the php-fpm script to the /etc/init.d directory

1

cp /home/soft/php-5.3.15/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

Copy after login

3. Set permissions and start php-fpm:

1

2

3

chmod 755 /etc/init.d/php-fpm

/etc/init.d/php-fpm start

chkconfig –add php-fpm

Copy after login

Finally, give php-fpm to start as a service, Stop and restart:

1

2

3

service php-fpm start

service php-fpm stop

service php-fpm reload

Copy after login

View version information

php -v

php install bcmath module

1 yum -y install php-bcmath

find / -name bcmath.so

2 Find the php configuration file

1

php -i |grep php.ini

Copy after login

Add the code: extension=bcmath.so

3Run php-m if it appears

1

php warning: Module 'bcmath' already loaded in unknow on line 0

Copy after login

It means that the bcmath module has been loaded multiple times, and step 2 is not necessary.

Encountered failure to install the repository file:

Install a higher version of php: use the yum source, enable remi-php56, and an error is reported when installing the extension:

1 yum -y install php-gd --skip-broken

2Yum source problem, the selected yum source and system version are not compatible

1

2

3

yum clean all

rpm --rebuilddb

yum update

Copy after login

Or change the yum source

1

yum install php-gd --enablerepo=remi-php56

Copy after login

The above is the detailed content of php5.5 installation tutorial. For more information, please follow other related articles on the PHP Chinese website!

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)