I just changed the directory of my WordPress instance. I copied all files via FTP into the new folder and also copied the database and edited the site URL and home entries.
Now the page don't show the images, but gives me this message:
Warning: imagejpeg() [function.imagejpeg]: Unable to open
'/www/htdocs/serverID/wp-content/uploads/bfi_thumb/modell3-2xr5ffo5juzmz3rgn84d8g.jpg'
for writing: Permission denied in
/www/htdocs/w00db707/wp-includes/class-wp-image-editor.php on line 405
Everything else is looking good. Do you know whats wrong?
Two possibilities:
The file/folder permissions for /wp-content/uploads/ need to be CHMOD to 0755 or 0777
If the permissions are already set to 0755 or 0777, the owning user/group needs to match your HTTPD user (varies based on server configuration; sometimes the user is www-data, sometimes apache, if a Plesk environment it is the username you setup the subscription with)
Related
I am trying to run some PHP applications on CentOS powered server with apache and MySQL. My apps have to create files on server, but it always says that permission is denied to create a file.
Files are located in /var/www/html. I even tried setting 777 permission to html folder and html/*. I changed apache user and group to myuser, that exists, and restarted apache. I changed the ownership of html folder and all files inside to myuser. I even tried changing document root to /home/myuser/public_html
I tried this code to test write permission. File location is /var/www/html/index.php and /home/myuser/public_html/index.php
$handle = fopen("a.txt", "w");
fwrite($handle, "test");
fclose($handle);
I am just more than amazed by this problem. The same configuration works on my another Ubuntu server.
Some geniuses must be here, help me.
You need to allow you server user to do write operation on your directory, User the below command, If it is a multilevel directory use -R flag.
sudo chown www-data my-dir
Instead of manually giving permission you can try chmod($handle, 0777) within your code.
I have Laravel 5.4 installed on my Mac using Composer and MAMP Pro. The installation completed successfully, but when I try to load localhost/lsapp/public, an UnexpectedValueException error is returned. I have checked the file permissions for the storage and logs directories and both are set to 755 using the command line. It seems the log file cannot be written for some reason. Any suggestions?
Full permission denied message: The stream or file "/Applications/MAMP/htdocs/lsapp/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
in StreamHandler.php (line 107)
When you go into a production environment, I'd recommend the following:
755 permissions for the /log
644 permission for the files inside
For example if you're using apache:
The user owner of the directory (www-data) can read, write and execute.
The assigned group (www-data, where my user is) can read and execute, but not write.
Everyone else can read and execute, but not write.
I just faced the same issue with my installation. Here's what I did to solve it:
Make sure that www-data (or your web server's user) is either the owner or group's owner of the logs directory.
Then make sure that this user have read-write-execute on that folder. On linux I used 770 for that folder. Then laravel is now working fine.
Hope that's help!
I'm trying to copy an uploaded file through php to a folder in the home directory. I gave every permission to the Apache user (www-data) but when I'm trying to copy it I get a warning "failed to open stream: Permission denied".
copy("$target_file", "/home/pap-x/meshes/Part_A.dae");
What's wrong?
In addition to www-data having permissions to the directory of $target, it must have at least execute permissions to every directory above the target. If any of those directories deny access then www-data will not be able to find the target directory.
I am working on Laravel 4. On remote server I took backup of old laravel.log and created new one and restored old one again by removing newly created one. Since then I am getting error:
Error in exception handler: The stream or file "/var/www/stage/webapp/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/staging_html/webapp/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84
I even change mode and but it did not work either. It's not happening across system, just a particular page.
I am on Amazon AWS
You recreated the file, so the permissions have changed, and apache can no longer access it. Run this in command line to set the permissions:
chown www-data:www-data /var/www/stage/webapp/app/storage/logs/laravel.log
That's if you're using apache. It changes ownership of the file to apache (web server). If the web server user isn't www-data. Find out by typing:
ls -l
In the command line to see what user owns the other files in your laravel directory. Replace www-data:www-data with the user that owns the other web files.
To be clear the left side of the colon is user group and the right side is the user. If you have a specific user group that needs access to those files as well like git or ftp, you may need to set it like this:
git:www-data
ftp:www-data
group:user //generic example
It just depends on your access requirements. If you have questions let me know.
I recently moved my website to a new host and now am experiencing some broken code..
I have an uploading script that is now returning this:
move_uploaded_file() failed to open
stream: Permission denied in *..
I've set the upload directory to 777 which worked fine, but my script is needed to have top level permissions..
(As the script itself sets permission to directories, does lots of copying etc)
Is there a way in apache I can set the PHP script to the owner of all the folders on my server?
Thanks
Also
When looking in phpInfo()
Under
apache2handler
User/Group nobody(99)/99
Is this related?
I wouldn't go that route, just give it permissions to the defined upload_tmp_dir, or define upload_tmp_dir to be a directory you have access to. If it is that directory you have problems with. If the target is the problem, and you've 777'ed it, something fishy is going on.
Do you have ssh access to your new host? The reason I ask is that it's probably not best to use the username/group as nobody, as most other services would use this too. I would change it to something like apache
You can then update httpd.conf, adding in these two lines (reloading the config after):
User apache
Group apache
Then, run chown apache:apache -R dir_name to make apache own it.
well,
When you are trying to set the permission like "0777", you must be running on same authority.
What I mean is.
For example, your script tells to change a folder/file permission to 0777, but the folder or file already has a permission and that is '0755' so you are not authorised to make that change. as the user have only 5 authority.
Either, you need to login to FTP and change the folder permission to 0777 and then you have full control over it or you have to stick with using 0755 or similar.