1 、如果之前已经安装我们先卸载一下

yum -y remove php*

2 、由于linux的yum源不存在php7.x,所以我们要更改yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm   
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm    

3、yum 安装php72w和各种拓展,选自己需要的即可

yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

4、xDebug配置(https://xdebug.org/wizard.php 检查配置状态)
a、下载xdebug-2.6.0.tgz,解压并切换到xdebug-2.6.0目录
b、执行 phpize
c、编译xdebug

./configure
make
cp modules/xdebug.so /usr/local/lib/php/pecl/20170718

d、更新php.ini配置

 /usr/local/etc/php/7.2/php.ini 
 zend_extension = /usr/local/lib/php/pecl/20170718/xdebug.so


[xdebug]
zend_extension=xdebug.so
xdebug.idekey = lihaijun
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_mode=req
xdebug.remote_host=localhost/127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.auto_trace=1
xdebug.collect_return=1
xdebug.collect_vars=1

e、重启web服务

Logo

更多推荐