PHP symlink(): Permission denied in writeable folder
I want to create a symlink with PHP.
The symlink needs to go in the same place as the uploaded file, which should be fine right?
My real problem is that when using symlink()
, I get a permission denied error on the same directory that PHP can write to from $_FILES
.
I have done a test using text.txt
as the test file, and link
as the symlink:
symlink("repository/text.txt", "link");
The PHP script is run from content/folder/script.php
. What am I doing wrong here? Do symlinks need file ext开发者_高级运维ensions (I doubt it) or something?
If this is the code you're using
symlink("repository/text.txt", "link");
And your script runs as /var/www/scripts/script.php
the symlink will be created in the directory the script runs in.
Try using an absolute path.
精彩评论