Post by ecostar » Mon May 23, 2022 9:17 pm

When I go to my homepage to launch the installation there is an error. I get a 500 Internal Server error. The PHP error log shows:

PHP Parse error: syntax error, unexpected '$expire' (T_VARIABLE) in E:\domains\mypackage\mydomain.net\system\library\session\file.php on line 71

I've worked around it by commenting out the code block with the error. The installation page is now showing. Hopefully I can continue without problems.

Its not a good solution as this is in the "destruct" method and could be important. I would like to know if there's a better way to fix this error without deleting code? Thanks.

This block of code is:

if ((rand() % $gc_divisor) < $gc_probability) {
$expire = time() - ini_get('session.gc_maxlifetime');

$files = glob(DIR_SESSION . 'sess_*');

foreach ($files as $file) {
if (filemtime($file) $expire) { Line 71
unlink($file);
}
}
}

Newbie

Posts

Joined
Wed May 18, 2022 10:06 pm

Post by rjcalifornia » Tue May 31, 2022 8:59 am

ecostar wrote:
Mon May 23, 2022 9:17 pm
When I go to my homepage to launch the installation there is an error. I get a 500 Internal Server error. The PHP error log shows:

PHP Parse error: syntax error, unexpected '$expire' (T_VARIABLE) in E:\domains\mypackage\mydomain.net\system\library\session\file.php on line 71

I've worked around it by commenting out the code block with the error. The installation page is now showing. Hopefully I can continue without problems.

Its not a good solution as this is in the "destruct" method and could be important. I would like to know if there's a better way to fix this error without deleting code? Thanks.

This block of code is:

if ((rand() % $gc_divisor) < $gc_probability) {
$expire = time() - ini_get('session.gc_maxlifetime');

$files = glob(DIR_SESSION . 'sess_*');

foreach ($files as $file) {
if (filemtime($file) $expire) { Line 71
unlink($file);
}
}
}
Yeah, that code doesn't seem right. Did you modify it before installing OpenCart?

Scroll down to line 71, if you are using version 3.x it should look like this:

Image
A2 Hosting features: Shared Turbo Boost, Managed Warp 1, Unmanaged Hyper 1, and Warp 2 Turbo


Active Member

Posts

Joined
Fri Sep 02, 2011 1:19 pm
Location - Worldwide

Post by straightlight » Tue May 31, 2022 9:24 am

ecostar wrote:
Mon May 23, 2022 9:17 pm
When I go to my homepage to launch the installation there is an error. I get a 500 Internal Server error. The PHP error log shows:

PHP Parse error: syntax error, unexpected '$expire' (T_VARIABLE) in E:\domains\mypackage\mydomain.net\system\library\session\file.php on line 71

I've worked around it by commenting out the code block with the error. The installation page is now showing. Hopefully I can continue without problems.

Its not a good solution as this is in the "destruct" method and could be important. I would like to know if there's a better way to fix this error without deleting code? Thanks.

This block of code is:

if ((rand() % $gc_divisor) < $gc_probability) {
$expire = time() - ini_get('session.gc_maxlifetime');

$files = glob(DIR_SESSION . 'sess_*');

foreach ($files as $file) {
if (filemtime($file) $expire) { Line 71
unlink($file);
}
}
}
OC version. See this line: https://github.com/opencart/opencart-3/ ... le.php#L69

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ecostar » Thu Jun 02, 2022 12:10 am

Thanks, thats helpful. I can see there is a < missing from that line of code.

This is version 3.0.3.8. I downloaded it from the OpenCart website and didn't modify it. Maybe that file got corrupted somehow.

Newbie

Posts

Joined
Wed May 18, 2022 10:06 pm

Post by rjcalifornia » Tue Jun 07, 2022 10:09 am

ecostar wrote:
Thu Jun 02, 2022 12:10 am
Thanks, thats helpful. I can see there is a < missing from that line of code.

This is version 3.0.3.8. I downloaded it from the OpenCart website and didn't modify it. Maybe that file got corrupted somehow.
Probably, because I downloaded it and it was fine.

Image
A2 Hosting features: Shared Turbo Boost, Managed Warp 1, Unmanaged Hyper 1, and Warp 2 Turbo


Active Member

Posts

Joined
Fri Sep 02, 2011 1:19 pm
Location - Worldwide
Who is online

Users browsing this forum: No registered users and 118 guests