[root@VM_0_5_centos ~]# cd /home/
[root@VM_0_5_centos home]#
mkdir
-p work/study/softpackage
[root@VM_0_5_centos softpackage]# pwd
/home/work/study/softpackage
[root@VM_0_5_centos softpackage]# ll
total 14900
-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2
[root@VM_0_5_centos softpackage]# tar -xjvf php-7.2.29.tar.bz2
drwxrwxr-x 14 root root 4096 Mar 17 18:16 php-7.2.29
-rw-r--r-- 1 root root 15235268 Apr 2 21:19 php-7.2.29.tar.bz2
[root@VM_0_5_centos softpackage]# cd php-7.2.29/
[root@VM_0_5_centos php-7.2.29]# yum install gcc
----
configure: error: libxml2 not found. Please check your libxml2 installation.
----
yum -y install gcc libxml2 yum -y install php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel
[root@VM_0_5_centos php-7.2.29]# ./configure --prefix=/home/work/study/soft/php
[root@VM_0_5_centos php-7.2.29]# make
[root@VM_0_5_centos php-7.2.29]# make install
[root@VM_0_5_centos php-7.2.29]# cd /home/work/study/
[root@VM_0_5_centos study]# ll
total 8
drwxr-xr-x 3 root root 4096 Apr 2 22:04 soft
drwxr-xr-x 3 root root 4096 Apr 2 21:44 softpackage
[root@VM_0_5_centos study]# cd soft/php/
[root@VM_0_5_centos php]#
[root@VM_0_5_centos php]# ./bin/php -m
[root@VM_0_5_centos php]# vim test.php
[root@VM_0_5_centos php]# ./bin/php test.php
1585836467[root@VM_0_5_centos php]#
[root@VM_0_5_centos php]# vi ~/.bash_profile
# .bash_profile
# Get the aliases
and
functions
if
[ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment
and
startup programs
PATH=
$PATH
:
$HOME
/bin
export PATH
alias php=/home/work/study/soft/php/bin/php
[root@VM_0_5_centos php]# source ~/.bash_profile
[root@VM_0_5_centos php]# php -v
PHP 7.2.29 (cli) (built: Apr 2 2020 22:03:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
[root@VM_0_5_centos study]#
mkdir
demo
[root@VM_0_5_centos study]# cd demo/
[root@VM_0_5_centos demo]# vim t.php
[root@VM_0_5_centos demo]# php t.php
1585836787[root@VM_0_5_centos demo]# pwd
/home/work/study/demo