我正在尝试使用PHP localhost/PhpProject3/create.php创建新文件夹:
<?php mkdir('newdir', 0777); ?>
但是这段代码并没有实现它。它也不起作用:
<?php mkdir('/var/www/PhpProject3/newdir',0777); ?>
我安装了LAMP。我认为问题在于设置(可能是chmod?),因为PHP脚本可以正常工作。例如,我创建了一个简单的test.php:
<?php echo 'Great'; ?>
运行它:localhost/PhpProject3/test.php
,结果很棒。
我使用Netbeans。 这里是文件:/var/www/PhpProject3。 我运行它:localhost/PhpProject3/... /etc/apache2/sites-available/default的内容如下:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
我也无法使用touch()创建文件。
有人能帮帮我吗?