开发者

rename() PHP function cannot find directory even though it is there?

开发者 https://www.devze.com 2023-01-23 18:27 出处:网络
I have just created a new folder on my server, and all the right permissions are set, I am sure of it.

I have just created a new folder on my server, and all the right permissions are set, I am sure of it.

The folder is there, but my PHP cant find the actual folder anyways?

Any ideas why?

The only thing I can think of is that my folder has special characters in its name.

I create it with this command:

   sudo mkdir "Textiler & Sybehör"

I have lots of other directories with these kind of characters and they work fine.

Just this one seems to not work...

I am stuck!

PHP says cannot find directory...

UPDATE:

In command line tool, I tried moving the dir like this:

 mv "Textiler & Sybehör" images/"Textiler & Sybehör"

I get this error:

cannot stat `开发者_运维百科Textiler & Sybeh\366r': No such file or directory

It is like if the letter "ö" isn't interpreted correctly.


When you make a directory with sudo that means it is created as the super or root user. If your web server is using suexec and running PHP as a normal user, PHP will not be able to access folders and/or files owned by other users.

Check to see if suexec is being used by or on your hosting provider or server.

The other thing is to determine if your folder really needs to be owned by the root user. If not, use the following command to change the owner: sudo chown <regular_user>:<regular_user> where <regular_user> is the account that PHP is running as.


Although it might be because of the characters in the name. What about folder structure? Do you have an .htaccess file with a rewrite base set? Code snippet would be great.

Also may as well check ownership permissions (chown) and then chmod the folder so it's writable.

0

精彩评论

暂无评论...
验证码 换一张
取 消