Forum

Thread tagged as: Question, Problem, Error

Perch not loading locally

Hello,

I have been having problems with running perch on localhost. I have set it up with Github and Mamp pro. I am getting an error in the php log saying "PHP Fatal error: Call to undefined function perch_content_custom("

I seem to have the exact same setup as my colleague but mine just wont display.

Can anyone think of what might be the issue here?

Stephen Shaw

Stephen Shaw 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

You either have missing files or your runtime include is wrong I would imagine. Other than that we'd need a bit more information to help.

The runtime include is in place and exactly the same as my colleague. It doesnt seem to be working on my Macbook Pro or my iMac , whereas his macbook has no issues.

I am trying to run the website locally through GitHub and MAMP PRO. The server is set to Port 8888 but when I go to the URL, nothing displays. On looking at the PHP logs within MAMP Pro, I get the following message:

[26-Nov-2014 12:48:59 Europe/London] PHP Fatal error: Call to undefined function perch_content_custom() in /Users/NathanNelson/Documents/Github/martinacollins/application/views/includes/nav.php on line 6

Line 6 consists of this:

perch_content_custom('Contact Details', array( 'page' => '/contact', 'template' => 'header_phone.html', ));

Hope this helps you understand

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you included the Perch runtime before including the nav.php file?

yes its included in the header which loads in before the nav. If I remove the perch from the nav.php file then the error simply jumps to the next available perch element (in this case, home.php)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do the basic example pages work?

I probably should have mentioned that the website is built using the CodeIgniter framework

I tried downloading the Perch example files and I am receiving the same error message in the PHP Logs

Drew McLellan

Drew McLellan 2638 points
Perch Support

Within or without CI?

I tried the example files without CI

Drew McLellan

Drew McLellan 2638 points
Perch Support

Did you get a pass from the compatibility test? Something sounds very wrong.

It did yeah.

The strangest thing is that it works completely perfectly on my colleagues machine, and the set up is identical. The issue seems to be across all of my github projects that have perch installed on them too

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I'm not sure how I can best help.

I had a similar situation - not with CodeIgniter and Perch, but with with Laravel and Perch:

If I remember correctly it was one, or all, of these: 1. the perch core folder had a .gitignore in it that I had to remove i.e. core wasn't uploaded to github, 2. the resources folder was empty so I had to put something in it - anything - git won't upload an empty folder, and 3. I had to name the pages (just after the include perch) so that perch could recognise them (this is documented in the perch docs)

Hope it helps? Martin Rowe

I literally just noticed this myself this morning. Wish I had of seen this post before hand. Turned out to be the .gitignore file that was blocking the core.

Many thanks for the help!

Drew McLellan said:

Did you get a pass from the compatibility test? Something sounds very wrong.

Do you have to run a compatibility test for a WAMP localserver as well?