0
votes

Can anyone suggest why vQmod fails to write cache files and instead writes an empty file named vq2-C to /vqmod/vqcache?

Environment Windows Server 2012 Plesk Panel 12.5 PHP 5.3.2.9 MySQL 5.6.26 OpenCart 2.1.0.1 vQmod 2.6.1

Issue vQmod fails to save modifications to /vqmod/vqcache/vq2-*.php

On each page load it applies modifications specified in /vqmod/xml/*.xml and writes an empty file named vq2-C to /vqmod/vqcache.

Background The affected website was migrated from another Windows box with similar configuration.

In short the old server ran Plesk Panel 12.0, the new server is Plesk 12.5 so has minor updates to software versions.

Both sites run on PHP 5.3.2.9 and the new server follows OWASP recommendations more closely so has more PHP functions disabled eg. fopen_with_path.

Investigation so far Running the vQmod installer again reports: VQMOD ALREADY INSTALLED!

File permissions /vqmod/logs and /vqmod/vqcache have modify permissions, files are written here. Permissions are applied through Plesk Panel, checked over remote desktop and enabling global write permissions on web root through Plesk does not change anything.

Logs vQmod logs have no useful information, only skipped files are noted eg. VQModObject::parseMods - Could not resolve path for [ catalog/language/english/module/featured.php] (SKIPPED).

No php_error.log files are generated.

Failed Request Tracing does not pick up any issues.

Tests All /vqmod/xml files have been removed except vqmod_opencart.xml and one that modifies column_left.tpl. These modifications are applied successfully but no cache files are generated in /vqmod/vqcache.

If I remove /vqmod/checked.cache and /vqmod/mods.cache the files are regenerated on next page load.

vQmod versions - rolled back to 2.5.1 but the issue persists.

Other considerations When one particular vQmod modification is enabled page load time is unacceptably slow (up to 20 sec). The modification displays the first 4 products from sub categories on the parent category page. I've not gone through the code yet but assume it's hitting pretty hard on the database.

On the original server page load was sub 2 seconds. I doubt this is related to the cache issue as that seems to be a permissions problem.

2

2 Answers

0
votes

I had such an issue with mine, I later found out that the issue was with directory permissions, in this case, might be caused by moving. Set permissions of vqcache folder recursively to 777. It worked for me.

0
votes

My apologies, I should have updated this sooner.

The issue relates to case sensitive preg_replace.

In short changing line #120 of vqmod.php from

$stripped_filename = preg_replace('~^' . preg_quote(self::getCwd(), '~i') . '~', '', $sourcePath)

to

$stripped_filename = preg_replace('~^' . preg_quote(self::getCwd(), '~i') . '~i', '', $sourcePath);

Means the /vqmod/vqcache/vq2-*.php cache files are written and the website runs as normal.

Explained in more detail at https://github.com/vqmod/vqmod/issues/81

I don't think the preg_quote should have the i argumment but it's in the original code so I left it in.