I've researched this and found other questions (PHP class not found but it's included) but they don't answer this stupidly simple problem!
Here's the error: Class 'Functions' not found in /public_html/sites/sitename/index.php
My folder structure is like this:
public_html/assests/php/functions.php //class
I require_once this file from here: public_html/sites/sitename/index.php
I've checked the file_exists, of course it does else require_once would fail. What is going on?!
Here's my code (just in case I've missed something really dumb...)
require_once('../../assets/php/functions.php');
if( file_exists('../../assets/php/functions.php') ){
error_log('Of course it exists!');
}
else{
error_log('Oh dear...');
}
$fn = new Functions();
Contents of functions.php (edited for brevity):
class Functions{
public function functions(){
//constructor
}
//pretty print
public function pp($str){
return '<pre class="pre-show prettyprint">'.htmlentities($str).'</pre>';
}
}