Post by renegadomty » Fri Jun 17, 2016 3:29 am

PHP Notice: Undefined variable: expire in C:\inetpub\wwwroot\oc\system\library\template.php

Hi guys, how are you?
First at all, Sorry for my English , but im gonna try to write the best of me.
Well.
im new in PHP, but, with some tutorials im turn on the MySql Server and PHP extensión in my IIS 7.5

Well, the problema is this

When im trying to open the OpenCart Installation, this throw me an exception: "PHP Notice: Undefined variable: expire in C:\inetpub\wwwroot\oc\system\library\template.php on line 9 ".

when i put this into a GoDaddy, this Works fine!!, but in my local machin this fail..
Can you help me please


im using:

PHP 7
Windows 7 profesional
MySql 5.7

Best regards.

Newbie

Posts

Joined
Fri Jun 17, 2016 3:24 am

Post by doktorek » Wed Oct 19, 2016 7:41 am

I had that error no matter what I did. Even when installing a new version from scratch. Downgrade your php version. I had it at 7.1 when I had the error. Now I set in the cpanel to version 7.0 and it is gone.

So whenever you get this error - downgrade PHP version

New member

Posts

Joined
Thu Apr 28, 2016 8:40 pm

Post by damodaranudas » Tue Apr 04, 2017 2:00 am

doktorek wrote:
Wed Oct 19, 2016 7:41 am
I had that error no matter what I did. Even when installing a new version from scratch. Downgrade your php version. I had it at 7.1 when I had the error. Now I set in the cpanel to version 7.0 and it is gone.

So whenever you get this error - downgrade PHP version
I had the same issue, downgrading to PHP 7.0 fixed it as well :)

User avatar
Newbie

Posts

Joined
Tue Nov 20, 2012 1:20 am
Location - Colombia

Post by burley » Thu Apr 20, 2017 4:39 pm

I'm having the same issue! Also on a clean install, on a local server.

But surely, downgrading the PHP version could not be the final and best solution?!

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by artcore » Thu Apr 20, 2017 5:07 pm

Came across it a few days ago as well after updating to php7.1
I did a quick fix:
if(!isset($expire)){$expire=86400;}
$this->adaptor = new $class($expire);

Didn't check what expire means in context or what called it, just added a default value of 1 day as it sounded like a cache expiration time.

User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by burley » Thu Apr 20, 2017 5:17 pm

Will defenitly give that a try!

Thanks!!

User avatar
Active Member

Posts

Joined
Sun Oct 09, 2011 3:30 pm

Post by vytasm » Tue Nov 07, 2017 4:23 pm

Regarding this error I found almost same code in "system\library\cache.php" on line 5

Code: Select all

public function __construct($adaptor, $expire = 3600) {
    $class = 'Cache\\' . $adaptor;
So it looks like constructor is missing one parameter, if I am right You need to add second parameter "$expire = 3600" in "system\library\template.php" file on line 5

Code: Select all

public function __construct($adaptor, $expire = 3600) {
    $class = 'Template\\' . $adaptor;

Newbie

Posts

Joined
Wed Feb 01, 2012 5:28 pm

Post by windows95 » Sat Nov 18, 2017 5:13 am

Thanks for the fix. Both expiration edits worked like a charm

Newbie

Posts

Joined
Wed Aug 16, 2017 6:22 am
Who is online

Users browsing this forum: mithunvijay and 42 guests