Page 1 of 1

Fatal error: Class not found

Posted: Tue Jun 17, 2008 4:07 pm
by ZippyDan
im trying to move a website from one host to another and i simply copied everything via ftp from one host to the other. i am not sure about differences in PHP but I am sure they are both running PHP. the relative tree structure of both websites is identical. the following error is from a subpage on the server:

"Fatal error: Class 'Montage' not found in /home/content/m/a/r/marksunderland/html/home_drapery.php on line 8"

this is the code that is generating the error:

Code: Select all

<?php
    $montage = new Montage("images/antiques/montage");
    $images = $montage->getRandomImages();
?>
the following is from the homepage which has no errors:

Code: Select all

<?php
    require_once('includes/inc_globals.php');
    require_once('includes/inc_gallery.php');
    require_once('includes/class.Montage.php');
    
    $incPath = "includes/" . $global_domain->getHdrInclude(); 
?>
im thinking the error may be a result of differences in PHP configuration. there is a php.ini file that came default with the new host which did not exist on the old host (at least, nowhere i could access by ftp.) and right now my suspicions lie there. i changed register_globals to on in hopes of fixing the problem, but no results yet. i do not have direct access to the php server as this is a shared hosting account. here is the current php.ini:

Code: Select all

register_globals = on
allow_url_fopen = off
expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
 
 
[Zend]
 
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so
i'm thinking that possibly although i have set globals to on in the ini, it has not actually taken effect. additionally, it seems that using globals is bad form anyway. so im wondering what i would need to do to make globals unnecessary in this situation. or i could be on completely the wrong track and it has nothing to do with globals...

please note i am a complete php noob

Re: Fatal error: Class not found

Posted: Tue Jun 17, 2008 4:50 pm
by it2051229
is your hosting site OXYHOST??

Re: Fatal error: Class not found

Posted: Tue Jun 17, 2008 4:50 pm
by ZippyDan
no, godaddy (i hate them so far, but its not my choice)

Re: Fatal error: Class not found

Posted: Tue Jun 17, 2008 5:04 pm
by it2051229
crap... lol what i usually do is a trial and error.. try moving the class file into the directory where the php file uses it.. and give it a try... if it still doesn't work?? oopppsss check your code

Re: Fatal error: Class not found

Posted: Thu Jun 19, 2008 5:31 pm
by ZippyDan
anyone?

Re: Fatal error: Class not found

Posted: Thu Jun 19, 2008 5:40 pm
by nowaydown1
The line:

Code: Select all

 
require_once('includes/class.Montage.php');
 
Needs to be in that same file where you're trying to instantiate the Montage class (or at least in the same scope). If this worked on your previous webhost as-is, I would guess somehow or another you probably had the /includes directory as part of your include_path.

Re: Fatal error: Class not found

Posted: Thu Jun 19, 2008 6:44 pm
by ZippyDan
th
nowaydown1 wrote:The line:

Code: Select all

&nbsp;
require_once('includes/class.Montage.php');
&nbsp;
Needs to be in that same file where you're trying to instantiate the Montage class (or at least in the same scope). If this worked on your previous webhost as-is, I would guess somehow or another you probably had the /includes directory as part of your include_path.
thanks, i tried adding that to my php page before, and i got more errors farther down the line. so im guessing that you are probably right about the include_path. it would help me very greatly if you could tell me where and how (syntax) i specify the include_path. i told you im a newb. :-)

Re: Fatal error: Class not found

Posted: Tue Jul 08, 2008 2:57 pm
by ZippyDan
i still can't get this working. anyone? :-(