What to do if the command line cannot be executed under php7
php7下命令行无法执行的解决方法:1、打开php.ini配置文件;2、关闭安全模式;3、禁用函数列表“disable_functions = proc_open,shell_exec”即可。
本文操作环境:windows10系统、php 7、thinkpad t480电脑。
php7下无法执行cmd命令行的原因是我们没有关闭php.ini配置文件中的安全模式,只要将安全模式关闭就可以了。
接下来我们一起来看看具体步骤:
在php.ini文件中配置safe_mode参数支持命令执行的方法:
首先打开php.ini;
然后关掉安全模式safe_mode = off;
最后禁用函数列表 disable_functions = proc_open, popen, exec, system, shell_exec ,把exec去掉。
示例:
<?php exec("mkdir d:\\test",$out); print_r($out); ?>
执行该php文件,会发现在d盘下多了一个test文件夹。
相关介绍:
PHP(PHP: Hypertext Preprocessor)即“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法学习了C语言,吸纳Java和Perl多个语言的特色发展出自己的特色语法,并根据它们的长项持续改进提升自己,例如java的面向对象编程,该语言当初创建的主要目标是让开发人员快速编写出优质的web网站。PHP同时支持面向对象和面向过程的开发,使用上非常灵活。
推荐学习:php培训
The above is the detailed content of What to do if the command line cannot be executed under php7. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6
Visual web development tools

Atom editor mac version download
The most popular open source editor
