简体   繁体   中英

Why getting Permission Denied error while using mkdir with PHP on XAMPP Linux

I'm using XAMPP on my CentOS server. I just wrote a simple file upload script with PHP but there is a problem using mkdir() function, because of the error below:

Warning: mkdir(): Permission denied in /opt/lampp/htdocs/script.php on line 10

Also I can not use move_uploaded_file, because of the same problem.

How can I fix this issue?

You need to give permission to your web server or www folder like this, here www-data is apache group and user, make sure you have one apache user and group.

chown -R www-data:www-data /path/to/webserver/www

chmod -R g+rw /path/to/webserver/www

In your case

chmod -R g+rw /opt/lampp/htdocs

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