You are here: Cannot instantiate non-existent class « PHP Programming Language « IT news, forums, messages
Cannot instantiate non-existent class

Posted by julian_m on 02/28/06 21:04

I'm having problems with include. I wrote a small example which shows
what's going on...

I should say that the problems started after I moved to a shared
server. All was working fine in my local server...


file test.php
---------------------------------------------------
<?php

echo '<html>';
echo '<head>';
echo '</head>';
echo '<body>';

echo "including inc.php<br>";

include("http://my_site/inc.php");

echo "inc was included<br>";

$clsIncClass = new ClsIncClass;

echo '</body>';
echo '</html>';

?>

file inc.php
---------------------------------------------------
class ClsIncClass {
function ClsIncClass() {
echo "ClsIncClass constructor<br>";
}
}


result in browser:

including inc.php
class ClsIncClass { function ClsIncClass() { echo "ClsIncClass
constructor
"; } }inc was included

Fatal error: Cannot instantiate non-existent class: clsincclass in
/home/ke000067/public_html/test1.php on line 21

Note that it seems that inc.php was included as if it were a text file,
but as you can imagine, it's not my intention...


So, i decided to change

include("http://IP_of_my_site/inc.php");

to

include($_SERVER['DOCUMENT_ROOT']."/my_site/inc.php");

but the result was

including inc.php

including inc.php

Warning: main(/opt/apache/htdocs/~ke000067/public_html/inc.php): failed
to open stream: No such file or directory in
/home/ke000067/public_html/test1.php on line 15

Warning: main(/opt/apache/htdocs/~ke000067/public_html/inc.php): failed
to open stream: No such file or directory in
/home/ke000067/public_html/test1.php on line 15

Warning: main(): Failed opening
'/opt/apache/htdocs/~ke000067/public_html/inc.php' for inclusion
(include_path='.:/opt/apache/lib/php') in
/home/ke000067/public_html/test1.php on line 15
inc was included

Fatal error: Cannot instantiate non-existent class: clsincclass in
/home/ke000067/public_html/test1.php on line 23


Anyone could give me some hints?

regards - jm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация