Post by robter1973 » Fri Oct 13, 2023 6:23 am

Hi I have a problem within my opencart site in version 2.0.1.1. with php 7.4. These errors are generated in the error log file:

PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/PHP Warning: flock () expects parameter 1 to be resource, bool given in /var/www/vhosts/PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file.php on line 51
2023-10-12 21:56:32 - PHP Warning: fwrite() expects parameter 1 to be resource, bool given in /var/www/vhosts/PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file.php on line 51
2023-10-12 21:56:32 - PHP Warning: fwrite() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 53
2023-10-12 21:56:32 - PHP Warning: fflush() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 55
2023-10-12 21:56:32 - PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 57
2023-10-12 21:56:32 - PHP Warning: fclose() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 59
/httpdocs/system/library/cache/file.php online 53
2023-10-12 21:56:32 - PHP Warning: fflush() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 55
2023-10-12 21:56:32 - PHP Warning: flock() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 57
2023-10-12 21:56:32 - PHP Warning: fclose() expects parameter 1 to be resource, bool given in /var/www/vhosts/######/httpdocs/system/library/cache/file .php online 59

These errors cause me to display the front of the site incorrectly. Can you help me solve this problem? Thank you

Newbie

Posts

Joined
Fri Oct 09, 2020 6:17 pm

Post by ADD Creative » Fri Oct 13, 2023 4:19 pm

The issue is OpenCart us unable to write a cache file. Check the permissions on the system/cache directory.

If that small warning caused problems then you probably have display errors on. Not only can this cause minor notices and warnings to cause bigger errors, it can also be a security risk.

You need make sure display errors in set to off in all 3 places. Your PHP settings, in system/config/default.php and in the settings.

1. In your PHP settings make sure display_errors is set to Off. Use phpinfo() to check. It should be off by default, but there are lots of rubbish hosts out there.

2. In system/config/default.php set error_display to false (2.2.x and above).

3. In your OpenCart Setting on the server tab set Display Errors to No.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by paulfeakins » Fri Oct 13, 2023 7:30 pm

As above it could be to do with reading/writing files, perhaps check you're not out of disk space and contact your host?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by robter1973 » Sat Dec 02, 2023 7:43 am

The issue is OpenCart us unable to write a cache file. Check the permissions on the system/cache directory.

If that small warning caused problems then you probably have display errors on. Not only can this cause minor notices and warnings to cause bigger errors, it can also be a security risk.

You need make sure display errors in set to off in all 3 places. Your PHP settings, in system/config/default.php and in the settings.

1. In your PHP settings make sure display_errors is set to Off. Use phpinfo() to check. It should be off by default, but there are lots of rubbish hosts out there.

2. In system/config/default.php set error_display to false (2.2.x and above).

3. In your OpenCart Setting on the server tab set Display Errors to No.
Do you have any other suggestions for me regarding this problem of mine? I thank you in advance.

Newbie

Posts

Joined
Fri Oct 09, 2020 6:17 pm

Post by ADD Creative » Sat Dec 02, 2023 8:26 am

Only what has already been suggested.

Switch off display errors.
Check both your PHP and OpenCart error logs.
Check permissions.
Contact your host.
Disable any extensions.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 53 guests