apache - PHP don't create the folder mkdir() -
i trying create new folder using php localhost/phpproject3/create.php:
<?php mkdir('newdir', 0777); ?>
but code doesn't it. doesn't work :
<?php mkdir('/var/www/phpproject3/newdir',0777); ?>
i installed lamp. think problem in settings (maybe chmod ?) because php script works. example create simple test.php:
<?php echo 'great'; ?>
and run it: localhost/phpproject3/test.php
result great.
i use netbeans. here files: /var/www/phpproject3 . run it: localhost/phpproject3/... content of /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 </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bin/ <directory "/usr/lib/cgi-bin"> allowoverride none options +execcgi -multiviews +symlinksifownermatch order allow,deny allow </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 allow 127.0.0.0/255.0.0.0 ::1/128 </directory> </virtualhost>
i can't create file using touch().
can me ?
which user webserver run as? can see if write
ps aux
and take look. user www-data (if use ubuntu).
then chown dir user , give user write permissions directory.
chown www-data /var/www/phpproject3
and
chmod u+w /var/www/phpproject3
an alternative instead use group permissions.
chgrp www-data /var/www/phpproject3
and
chmod g+w /var/www/phpproject3
assuming webserver runs group www-data.
Comments
Post a Comment