Resolving an unable to fork PHP warning in Windows
来源:互联网 发布:桌面软件编程语言 编辑:程序博客网 时间:2024/05/16 06:20
Resolving an unable to fork PHP warning in Windows
Symptoms
In Windows, when trying to execute a system call from a PHP script, you receive a warning like "Warning: system() [function.system]: Unable to fork". A related warning message is "Warning: shell_exec() [function.shell-exec]: Unable to execute"
Sample Code
<?php// print output of shell command executed with backtick operatorprint htmlentities(`dir`);?>
Cause
The most likely cause is insufficient permissions to execute system calls in the web server environment.
Fix
You need to give the Internet Guest Account (a.k.a. IUSR_MachineName or simply IUSR) read and execute permission to the command shell program,cmd.exe
. Typically, permission to this file is explicitly denied as a security measure.
- Open Windows Explorer and browse to the
c:\windows\system32
orc:\winnt\system32
directory. - Right-click on
cmd.exe
, and select Properties.... - Click the Security tab. See image below.
- If Internet Guest Account is not already listed, then click Add, thenAdvanced..., then Find Now.
- Scroll down to and select IUSR_MachineName, where MachineName is the name of your computer.
- Click OK twice to return to the Security tab.
- Select Internet Guest Account and then click the box under Allow forRead & Execute.
- Click OK.
Notes
It is a very bad idea to allow unvalidated input to any system calls. Remember to useescapeshellcmd for any commands that will contain user input.
You will have to give IUSR appropriate permissions to any other files and folders that the PHP script will access.
Read the Program Execution Functions reference materials in the PHP manual for more information.
Applies To
Windows XP, 2000, 2003, PHP, IIS 5.1, fork, system, exec, passthru, shell_exec, backtick operator
Disclaimer: This content is provided as-is. The information may be incorrect.
- Resolving an unable to fork PHP warning in Windows
- Resolving an unable to fork PHP warning in Windows
- PHP Warning: SQLite3::query(): unable to open database file in
- Warning: unable to open an initial console
- WARNING: Unable to open an initial console
- Warning: unable to open an initial console
- WARNING: Unable to open an initial console
- WARNING: Unable to open an initial console
- Warning: unable to open an initial console.
- PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0
- ubuntu下遇到Warning: unable to open an initial console.
- PHP Warning: mssql_connect() Unable to connect to server
- PHP Warning: PHP Startup: Unable to load dynamic library
- PHP Warning: PHP Startup: redis: Unable to initialize module
- Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap"
- Cacti安装错误:Warning: exec(): Unable to fork [c:/rrdtool/rrdtool.exe] 已解决
- warning: unable to bind to property '' on class 'Object' (class is not an IEventDispatcher)
- warning: unable to bind to property '' on class '' (class is not an IEventDispatcher)
- oracle 数据库,A 表有 10 条记录,以下查询可以查出几条? select * from A where rownum > 5
- Hibernate 主键生成策略
- 数据库基础及常用SQL语句
- js查看一个函数的执行所用时间
- 创建bus
- Resolving an unable to fork PHP warning in Windows
- 栈操作,构造,插入,删除,转换
- 博弈训练——nim与bash
- 操作系统基础及多线程/进程同步
- 苏轼
- 异常org.hibernate.HibernateException: The database returned no natively generated identity解决方案
- A-挂饰|01背包
- Android AudioTrack
- 安卓开发小知识 - 3