Forum

Thread tagged as: Problem, Error, Configuration

Perch includes error on WAMP

Yes I know I am "unique" in running a Windows environment, but I have been banging my head against a wall on this one. I've recently created a new Perch site using Perch 2.8.11 and I was getting

Warning: include(): Failed opening 'perch\templates\pages\employerSection.php' for inclusion (include_path='.;C:\php\pear')

It appears I did not have PEAR installed, so I have installed PEAR on WAMP and I amended my PHP.ini file to (what I believe to be) the correct include path but I am still getting the include errors like so

Warning: include(): Failed opening 'perch\templates\pages\employerSection.php' for inclusion (include_path='.;C:\wamp\bin\php\php5.4.12\pear')

Anyone experienced similar? Can anyone help......please!!

Many thanks

Lee

Lee Goodman

Lee Goodman 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Perch doesn't use Pear, so you don't need it installed on our account.

When do you get that error?

Hmmm I thought it was kind of strange thanks Drew, I get it as soon as I attempt to load the page. The first line in my template is

<?php include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); ?>

and I get the error

Warning: include(): Failed opening 'perch\templates\pages\employerSection.php' for inclusion (include_path='.;C:\wamp\bin\php\php5.4.12\pear') in C:\wamp\www\justhse\employers\index.php on line 1

I am totally stumped as to why this has suddenly started happening.

Ok turns out it was nothing to do with pear, include_path='.;C:\php\pear' is just the default line in php.ini on WAMP, but I am no closer to finding a solution.

I am going to check some previous Perch projects and also add this site to my dev server to check if it's a local config issue.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What is $_SERVER['DOCUMENT_ROOT'] set to? It should be in your diagnostics report.

Turns out I've been chasing a red herring for hours. Not sure if The issue was caused by me moving some pages in Perch.

This line in the index.php had an incorrect path

<?php include(str_replace('/', DIRECTORY_SEPARATOR, 'perch/templates/pages/employerSection.php')); ?>

instead of

<?php include(str_replace('/', DIRECTORY_SEPARATOR, '../perch/templates/pages/employerSection.php')); ?>

All sorted. Thanks Drew

Just for your information I moved index.php from employers\index.php to the root of the site as employers.php, I then changed it back to employers\index.php.

I just did a test and recreated the issue

after creating testing\index.php then via the page options I moved it and renamed it to the root as testing.php and the path now looks like so

<?php include(str_replace('/', DIRECTORY_SEPARATOR, 'perch\templates\pages\candidateSection.php')); ?>

I then moved and renamed the file back to it's original location i.e testing\index.php but the path remained as

<?php include(str_replace('/', DIRECTORY_SEPARATOR, 'perch\templates\pages\candidateSection.php')); ?>

Possible bug?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, I'd expect it to change.

Are you deploying to a Windows server when the site is live?

No it will be a LAMP stack, so I will need to change to forward slashes.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, we'll log the Windows issue to look into again.