cancel
Showing results for 
Search instead for 
Did you mean: 

Flush images not working | Magento has not permissions

SOLVED

Flush images not working | Magento has not permissions

Hello, 

 

I moved my Magento server and now my image cache will not works. After investigation, I found a potential reason. 

 

   Magento can't write on my server.

 

But I have no idea to solve it. All of my directories and files have 777 in permissions. The owner of my directories is the user "apache" (I read this user is the webserver user of centos).

 

Technical infos :

My server is running on CentOs 7 with PHP 5.6 and apache 2.4.6.

 

Other observations :

  • When I try to flush image cache, the directory "magento_root/media/catalog/product/cache" will not be removed.
  • When I try to upload an image with Magento admin, I get an error like directory will not exist or will not be writable. But when I check the specified directory, he has 777 in permissions.
  • When I go to Magento connect Manager, I get the error "Your Magento folder does not have sufficient write permissions.".
  • I copied the php.ini of my old server to my new server so memory_limit is enough (512 MB). I think other values are ok too but maybe I've wrong.
  • My server has all required php module like php-gd.

 

So my problem seems be in permissions but I have no idea how to solve it. I'm new in Linux and server configuration. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Flush images not working | Magento has not permissions

I get a solution on stack overflow, in my case, SELinux prevent my apache user to write into files server. So I disable his enforcing by this command 

sudo setenforce 0

and now, my website works like a charm.

 

Thx for your time and I'm sorry to ask into the wrong forum because Magento was not the cause. 

View solution in original post

5 REPLIES 5

Re: Flush images not working | Magento has not permissions

Hi @JulienVDB,

 

Using 777 permissions isn't recomended.

Maybe (just maybe) you have some issue with the user running the webserver.

You can read more about recomendations and how to fix permissions issues here (you'll find also the commands to fix the situation):

 

http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html#privs-after

 

Also, take a look on which user has the ownership of, for example, index.php and which user is the owner of var/cache/ files to be sure that the user is the same.

Re: Flush images not working | Magento has not permissions

Thx for your answer, 

 

About 777 permissions, I know it's not recommended but I use it just for development and test my new server, after this, I will fix it with 755. By the way, I didn't say it but my new server is only host in my local machine. The goal of my enterprise is to show the website without internet connection in a trade fair. So, the miss security with 777 permissions will not have a real problem.

 

About owner, root are the owner of my index.php and all other directories on my server. And in Magento files, it was 503 and 500 to owner user and owner group. But I change it to root:root and it still has not permissions. 

 

Which user is using by Magento to write into the webserver ? When I search about that, this seems to be the web server user (in my case, CentOS 7, "apache" ?). But I didn't find really sure information about that.

 

EDIT : I also check the var/cache. This directory will stay empty when i reindex all but magento admin but when I reindex all via "php indexer.php reindexall", the directories mage--x appears. The directories are writable by my root user but the Magento user can't. I think, the Magento user will not exist on my new webserver but I have no idea how to change him or how to show who is he ?

 

EDIT 2 : When I run the php  function "get_current_user()", it returns me an user "davidts". It's the ftp user name of my old server but I still not know where I can change it.

 

EDIT 3 : I still stuck but I know the problem comes from my server configuration and not my magento configuration, so I close this post. If someone has an idea to help me, he can answer it to 

http://stackoverflow.com/questions/41381097/miss-understanding-about-apache-and-permissions

 

Thx for reading

Re: Flush images not working | Magento has not permissions

Try running the command (on shell):

 

ps aux | egrep '(apache|httpd)'

First column will tell you which user is running Apache.

 

Re: Flush images not working | Magento has not permissions

I get a solution on stack overflow, in my case, SELinux prevent my apache user to write into files server. So I disable his enforcing by this command 

sudo setenforce 0

and now, my website works like a charm.

 

Thx for your time and I'm sorry to ask into the wrong forum because Magento was not the cause. 

Re: Flush images not working | Magento has not permissions

@JulienVDB,

 

Thank you for sharing the final resolution.