当前位置:网站首页>php的exec函数
php的exec函数
2022-06-10 20:44:00 【贪睡的蜗牛】
一、修改配置文件
新建一个php文件
<?php
$command = "pwd"; //ls是linux下的查目录,文件的命令
exec($command,$array); //执行命令
print_r($array);
?>
输入命令执行
php ./test.php发现异常

这是因为在php的配置文件中禁止了exec函数的运行,因此需要修改配置文件,使用下列代码找到配置文件
php -i|grep ini
进入配置文件,将exec函数删除
重启php-fpm
service php-fpm restart然后发现可以正常运行

二、exec函数
exec ( string $command [, array &$output [, int &$return_var ]] );exec有三个参数,第二个和第三个参数不是必需的。
第一个参数是执行的命令,第二个参数存储命令执行的输出,第三个参数返回执行的状态。
边栏推荐
- C language -- 11 branch statement if else
- Notes to entry: do I need to know programming for O & M?
- [Warning] TIMESTAMP with implicit DEFAULT value is deprecated
- Abbexa cell free DNA kit instructions
- Standard dual airbags, starting from 48900 for butcher Chang'an Lumin
- 【无标题】破目
- Quick start to VISSIM simulation
- LeetCode 进阶之路 - 167.两数之和 II - 输入有序数组
- Brute force method / task assignment
- Leetcode advanced path - delete duplicates in the sorting array
猜你喜欢
Super detailed tutorial for installing mysql8 in centos7 (no pit!)

Understanding of related concepts of target detection

Course design of imitation pottery ticket of wechat applet

Signal and system review 1

异步、线程池(CompletableFuture)

As a programmer, is it really that important for the underlying principles?

Constructing the implementation strategy of steam education for children

「运维有小邓」自助帐户解锁工具
一次SQL查询优化原理分析(900W+数据从17s到300ms)

C language -- 3 variables for beginners
随机推荐
MySQL范围查询优化的场景实例详解
设计多层PCB板需要注意哪些事项?
Redis cluster configuration
LeetCode 进阶之路 - 字符串中的第一个唯一字符
Abbexa low sample size chicken lysozyme C (Lyz) ELISA Kit
自媒体视频创作如何选择领域?
LeetCode 进阶之路 - 加一
Intelligent robot making progress in imitation learning
[nk] Niuke monthly race 51g calculation problem
Abbexa 8-OHdG CLIA kit solution
H.264中NALU、RBSP、SODB的关系
NFT copyright / royalties
Leetcode advanced road - 69 Square root of X
旋转菜单3.0
[untitled] broken item
MySQL insère les résultats de la requête dans une autre table
Standard dual airbags, starting from 48900 for butcher Chang'an Lumin
Install MySQL on Linux system. Problems encountered in xshell
Leetcode advanced path - delete duplicates in the sorting array
【北大青鸟昌平校区】职教与普教协调发展,今年的中考会容易吗?