So i have a problem with magento plugins writing files on my server. This seems that started after migrating the site to a new server. I have a plugin which used to generate an xml feed and save it on a folder (skroutz) in my server. However this doesn't work any more. These are my perms. I am not sure what is causing the problem. Not being able to write on Magento also causes other problems like importing products or updating stock.
Any help is more than welcome.
Hi @leokan23,
Writing files in a new folder located in the root is not a good practice. Generally speaking, you should always create new folders for your extensions in the var/ folder.
That being said, I would recommend you to run the following script in the root of your project to fix the permissions of your Magento instance:
# Set Magento root directory permissions # !/bin/bash if [ ! -f ./app/etc/local.xml ]; then echo "-- ERROR" echo "-- This doesn't look like a Magento install. Please make sure" echo "-- that you are running this from the Magento main doc root dir" exit fi if [ `id -u` != 0 ]; then echo "-- ERROR" echo "-- This script should be run as root so that file ownership" echo "-- changes can be set correctly" exit fi find . -type f \-exec chmod 644 {} \; find . -type d \-exec chmod 755 {} \; find ./var -type d \-exec chmod 777 {} \; find ./var -type f \-exec chmod 666 {} \; find ./media -type d \-exec chmod 777 {} \; find ./media -type f \-exec chmod 666 {} \; chmod 777 ./app/etc chmod 644 ./app/etc/*.xml
Best regards.
Gabriel
Thank you for your detailed reply.
Unfortunately, although i ran the script, i still have the same problems. My plugin doesn't seem to write on the server. I tried updating stock via uploading a .csv but it looks like it is never copied to the server. Could this be a problem with the server and not magento?
Hi @leokan23,
I would like to hear more about the problems you mentioned importing products or even updating stock.
That could give us a hint of the real problem in your server/Magento instance.
Could you please give more information about that?
Best regards.
Gabriel
So after migrating from another server (from a vps to our dedicated), we started seeing problems. Our 3 identified big problems are:
1. Importing a batch of products is not working. I navigate to catalog - import products, i select my zip file with the spreadsheet and hit run import. I either get an error 11 or an error saying that this is not a zip file. I think that the file is never uploaded on the server.
2. Update stock is not working. I navigate to sales - update stock, i select my csv and it says it is instantly uploaded and then gets stuck. even after waiting for 5 hours it didn't do anything.
3. Feed xml not saved on server. I use a special plugin to generate a feed xml for me. When you navigate to the link, it generates a feed with all the products, which used to be saved on /skroutz/skroutz.xml .Although it is generated and i can right click on my browser and save it (probably from an echo on php) the file is never saved on the server. I also tried other generators with the same problem.
Could this be a hosting problem?
Hey
After seeing your problem i would suggest you to change the ownership of your files and folders to apache's user.
For example : In case of Ubuntu servers you need to changethe ownership to www-data user and in case of centos based servers you need to change it to apache user.
I had a similar kind of problem and this fixed it all at once.
It looks like the owner of the files is the same as the account name. Is this correct? Should i change something in this?
yes change it to apache if you are using centos or www-data if you are using ubuntu