Home >Backend Development >PHP Problem >How to find the php path installed by yum

How to find the php path installed by yum

王林
王林Original
2020-07-10 16:15:233040browse

How to find the php path installed by yum: directly execute the [php -i | grep "Loaded Configuration File"] command. After using yum to install php, you can set it to start automatically at boot. The command is [systemctl enable php-fpm].

How to find the php path installed by yum

To find the php path installed by yum, execute the following command:

(Recommended tutorial: php tutorial )

php -i | grep "Loaded Configuration File"

Related introduction:

Yum installation method of php

# yum 未更新的安装源,PHP 版本为 5
yum install php php-fpm php-mysql php-gd php-pdo -y

# 9.5 更新
## 更新 PHP 安装源
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

## 安装 PHP 7.2 以及扩展
yum install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm \
php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

Start php-fpm

systemctl start php-fpm

# 设置开机启动
systemctl enable php-fpm	
ss -lntp
ps -ef | grep php

Firewall settings, open port 80

# 设置 iptables
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -nL

# 设置 firewalld
firewall-cmd --permanent --zone=public -add-port=80/tcp

PHP Configure Web Service

# 创建 test 目录
mkdir /data/test -p
cd /data/test/
vim /data/test/index.php

# 在目录下创建index.php文件,写入内容
<?php
header("Content-type:application/json;charset=utf-8");
$link = new PDO("mysql:host=localhost;dname=test","root","123456");
if(!$link){
	echo "Error connecting!";
}else{
	echo "Success!";
}
mysqli_close($link);
?>

# 运行
php -S locahost:8888

# 新开一个窗口登录服务器
curl localhost

Return Success, successful.

The above is the detailed content of How to find the php path installed by yum. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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