PHP mkdir(),chmod()和Windows [英] PHP mkdir(), chmod() and Windows
问题描述
我正在使用PHP函数mkdir($ path,0777)在Apache服务器上创建一个新目录(在Windows上运行)。
I am using the PHP function mkdir($path, 0777) to create a new directory on an Apache server (running on Windows).
当我创建并查看文件夹,Windows已将目录设置为只读。有没有使用exec()到cacls.exe来改变这种方法? PHP文档指出,chmod()在Windows上不起作用,但没有提供任何替代方法。
When I create this and view the folders, Windows has set the dir as read only. Is there a way of changing this without using exec() to cacls.exe? The PHP documentation states that chmod() doesn't work on Windows but doesn't say anything about a replacement method.
Google似乎对此没有帮助
Google seems to be a little unhelpful on this one.
编辑:经过几分钟的时间与我的两位教育机构的管理员交谈,似乎他们为学生测试的PHP服务器正在从一个USB驱动器上运行。我有一种感觉,这将与它有关系
After several minutes talking to administrators at my two-bit educational institution, it seems that their test PHP server for students is being run off of a USB drive. I have a feeling that this will have something to do with it slaps head
推荐答案
以下内容:
<?php
mkdir( "foo" )
?>
(注意没有指定模式)在Win2K上为我工作 - 它创建一个没有设置属性的文件夹。
(note no mode specified) works for me on Win2K - it creates a folder with no attributes set.
编辑:只是有一个想法 - 这可以与权限有关吗?尝试从命令行&看看会发生什么:
Just had a thought - could it be something to do with permissions? Try running the above code from the command line & see what happens:
C:> c:\php\pgp.exe
<?php
mkdir( "foo" )
?>
^Z
这篇关于PHP mkdir(),chmod()和Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!