简体   繁体   中英

PHP fopen on iis prob

I'm working on a Windows server with iis.

When i want to execute a php file it gives me the error:

Warning: fopen(path/script.php): failed to open stream: Permission denied in C:\\path\\path\\path\\script.php on line 71 Error opening

This is the code in the php file:

$var = fopen ($strFileName, 'w');   if(!$var) die(' Error opening');

There may be a few things that will help. First check your open_basedir restriction settings in your php installation .ini file.

open_basedir either needs to be set to the path that you want php to have file operation access to or you can set it to none to have no limitation.

Another thing to check is your environment variables on the machine that the code is being run on. Under environment variables find the entry for Path. Click edit and copy and paste what is in the value field to notepad. You want to make sure there is an entry that leads to your php installation folder as well as an entry that leads to where the code lives.

Example: C:\\PHP;C:\\websites;

Additionally, you will want to give the IIS User account full access to the location where your php code and the files you want to open exist.

你想要的是从另一个php执行php文件,但你的代码是错误的,因为你试图写入script.php而不是执行它[ 从另一个php执行php文件这个答案已经在链接中回答了;)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM