File could not be uploaded or revised

Our OJS was working fine until a few days ago we got the error message when trying to upload a “cover image” then when I tried to upload a pdf it gave a http error. Iv’e read other possible solutions and checked permissions, all looks good but still change permissions on the .php file mentioned in the error_log but still didn’t work so I reversed it to what it was before. The error_log shows a permission issue.

Appreciate any help please.

upload%20error

Hi @lvaiaoga

It isn’t a permission problem with your PHP files, but rather a problem with your cache/ folder. The warning is just being generated by the PHP file mentioned in the log entry. That cache/ folder needs to be writable by your webserver or whoever your PHP scripts run as.

Cheers,
Jason

Hi jnugent,

Thank you for the reply. Any suggestions how can I fix this error?

I did try giving writable access to that cache folder and files. I did 777 just to test it but it still gave the following error. I attached the error i’m getting now. The user is apache which is what we always used and was working until a few days ago. We didn’t do any updates to changes. Thanks for your help

OJS%20error ojs%20file%20permissions

Hi @lvaiaoga

That’s the wrong cache folder. You don’t want to change the classes responsible for the cache code, but rather the cache itself. Look carefully at the path in your error message. It’s /opt/ojs/311/cache

Cheers,
Jason

Hi jnugent,

Thank you for pointing that out. Sorry about that. I went the directory as you mentioned and it does look like the owner which is apache already has writable rights. I am fairly new to linux so excuse me if I miss something but im excited to learn something new every time haha. I will attach what I’m looking at. Any advise is appreciated.OJS%20error%203

Out of curiosity, where is your files_dir pointing to in your config.inc.php file, and what are the permissions on that?

Cheers
Jason

Hopefully this is what you are asking for. Thank you.OJS4 ojs5

Hi, did some more digging and found this. Please advise.

Thank you.OJS%20error%207

I was able to fix my original uploading error by reapplying this command.

setenforce 0

I still don’t know why all of a sudden I was unable to upload images and pdf’s but after some research, I finally decided to try and run the above command again and now i’m able to upload. Hope this helps someone. Thanks jnugent for trying to help. Appreciate it

@lvaiaoga Hi am facing same issue. please let me know where to find setenforce ??

setenforce is a linux command line command that needs to be run as the root user and can be used to disable SELinux, if you’re using it. You’d need to ask your systems administrator to run it for you.

Cheers,
Jason