3
votes

I am getting the following error after transferring the OpenCart website to new sever from old server. I have also changed the folder permission to 777 but still getting the error.

http://5cross.com/index.php?route=common/home

These are the errors I am receiving:

Warning: fopen(/home/cross5/public_html/system/logs/error.log): failed to open stream: Permission denied in /home/cross5/public_html/system/library/log.php on line 6

Warning: unlink(/home/cross5/public_html/system/cache/cache.currency.1440668347): Permission denied in /home/cross5/public_html/system/library/cache/file.php on line 17

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/cross5/public_html/system/library/log.php on line 10

Warning: unlink(/home/cross5/public_html/system/cache/cache.language.1440668347): Permission denied in /home/cross5/public_html/system/library/cache/file.php on line 17

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/cross5/public_html/system/library/log.php on line 10

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/cross5/public_html/system/library/log.php:6) in /home/cross5/public_html/system/library/session.php on line 12

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/cross5/public_html/system/library/log.php on line 10

Warning: fopen(/home/cross5/public_html/system/logs/openbay.log): failed to open stream: Permission denied in /home/cross5/public_html/system/library/log.php on line 6

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/cross5/public_html/system/library/log.php on line 1

3
it could also be problem with moved error.log file as if you just moved it in from old server it (error.log or any other file) could have different permissions or user:group even if you did change directory permissions. HTTP server software would then fail to write anything into that file, even when directory permissions are correctly set. - Sampo Sarrala - codidact.org
I would suggest also removing all old log and cache files whenever moving to new server. Just backup those if you think you'll ever need them. - Sampo Sarrala - codidact.org

3 Answers

8
votes

Please double check your permissions:

# OpenCart 1.5x
/system/logs/
/system/cache/

# OpenCart 2.1x and above
/system/storage/logs/
/system/storage/cache/

If you have console access (or ask your provider), you can do this by:

# OpenCart 1.5x
chmod 777 /home/cross5/public_html/system/logs/ -R
chmod 777 /home/cross5/public_html/system/cache/ -R

# OpenCart 2.1x and above
chmod 777 /home/cross5/public_html/system/storage/logs/ -R
chmod 777 /home/cross5/public_html/system/storage/cache/ -R
2
votes

Make sure you give all permissions to files

    chmod 0755 or 0777 system/storage/cache/
    chmod 0755 or 0777 system/storage/download/
    chmod 0755 or 0777 system/storage/logs/
    chmod 0755 or 0777 system/storage/modification/
    chmod 0755 or 0777 system/storage/session/
    chmod 0755 or 0777 system/storage/upload/
    chmod 0755 or 0777 system/storage/vendor/
    chmod 0755 or 0777 image/
    chmod 0755 or 0777 image/cache/
    chmod 0755 or 0777 image/catalog/
    chmod 0755 or 0777 config.php
    chmod 0755 or 0777 admin/config.php

Hope it will work for you!

0
votes

from the root directory, try change permissions of folders and files.

# File permissions, recursive
find . -type f -exec chmod 0644 {} \;
 
# Dir permissions, recursive
find . -type d -exec chmod 0755 {} \;