Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -
Anzahl Antworten: 14

Hi

we were having problems having our Moodle over the Internet and fixed this problem yesterday but are having a problem with opening quizzes and when viewing a course, none of the box formatting that surrounds the activities etc appears.

we fixed the problem of having Moodle over the internet by allowing email attachments with MS Outlook.  We were having attachment blocked error when trying to login to Moodle over the Internet.

here is the following error we receive when trying to open a quiz: Fatal error : Class name must be a valid object or a string in /var/www/moodle/lib/pagelib.php on line 67

Can anyone help here please?

Many thanks, Ali

Als Antwort auf Ali Hastie

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Gustav W Delius -
Ali, you can find more information about how to resolve this issue in bug 3659 and post http://moodle.org/mod/forum/discuss.php?d=27794#142217
Als Antwort auf Gustav W Delius

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -

Thanks Gustav for your reply.  What the above post is saying is that the error is related to the wwwroot address (which we have set ours for external and internal use as: "http://".$_SERVER["HTTP_HOST"]."/moodle";)

What should set the wwwroot address? we are also having the exact same error with chat along with all the smiley icons not displaying.

Once again many thanks for the reply,

Ali.

Als Antwort auf Gustav W Delius

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -

Hi again

Had a look at the issues within bug 3659 and tried many things that are recommended within their.  this included trying different wwwroot addresses including "http://".$_SERVER["HTTP_ADDR"]."/moodle"; (ours is set at "http://".$_SERVER["HTTP_HOST"]."/moodle"; )

and modifying weblib.php by changing $url_prefix = $protocol.$hostname; but still to no avail.

Can anyone help please?

Ali.

Als Antwort auf Ali Hastie

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Petr Skoda -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers
Hi!

Please do not try to set two or more different addresses for wwroot in config.php - because it can not and will not work. Instead setup DNS so that it points to wanted internal IP address in LAN and public IP from internet. Port numbers in wwwroot are not supported too.

The main reason for single wwwroot address is backup/restore process which can not be changed.

skodak
Als Antwort auf Petr Skoda

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -

Hi Skodak

thanks for that.  I have read elsewhere (im sure it was one of your previous posts) that we must NOT use two or more addresses which we have not since reading this.  Currently, we are using "http://".$_SERVER["HTTP_HOST"]."/moodle"; for wwwroot and works fully internally but as you can see we have not got it 100% externally.

your suggestion of the DNS setup has been carried out by our IT manager but I will double check. 

thanks for your reply and if you have any other answers these would be very welcome.

Ali.

Als Antwort auf Ali Hastie

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -

Hi

I have checked with our IT manager and he says that he has carried out the DNS setup.  I have tried all combinations (only single addresses) within the wwwroot but none of the addresses work accordingly.

the "http://".$_SERVER["HTTP_HOST"]."/moodle/>"; seems to work the best for us.   

Has anyone fixed this problem! i personally do not know what to try next!

Many thanks in advance,

Ali.

Als Antwort auf Ali Hastie

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Petr Skoda -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers
Please do not report any problems with "http://".$_SERVER["HTTP_HOST"]."/moodle"; because it can NOT work.

You are using variable in wwwroot, not one address. Use following setup:
  1. setup your DNS server that is serving your internal lan computers to return internal www server (your.company.com) IP number ex.:"192.168.147.100"
  2. set moodle wwwroot to "http://your.company.com/moodle"

Now when outside (== internet) users request DNS resolution they will get your public IP. On the other hand internal LAN users receive 192.168.147.100.

That's all, you have one wwwroot address and two different IP addresses.
Als Antwort auf Petr Skoda

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Steve Gale -
What if "http://your.company.com/moodle" doesn't work though?

People keep saying that the answer to this problem is to correctly set your wwwroot to "http://your.company.com/moodle" in the config.php file.

It's not the answer for everyone though as I cant get ti to work and neither can some other people. I'm not doing anything clever on my server. It's externally hosted, only accessed via one address and the server is only running moodle!

Does it have to be a www. address? surely "http://manxsrv1.cust.phonecoop.coop/moodle" should work?

Cheers,
Steve
Als Antwort auf Steve Gale

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -

I think your right Steve!  I have spent a whole day trying with the wwwroot address with many combinations (including if and else statements, IP's and URLs) and still receive the exact same results with the quiz, chat and centre column design.  We also have tried with the DNS recommended within the above post and still no progress.

I also tried to ammend the weblib.php file mentioned within the Quiz!

Please, even if we have the Quiz fixed, could someone help!!

Cheers,

Ali. 

Als Antwort auf Steve Gale

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Ali Hastie -

Hi again!!

Yes we still have the quiz fatal error and was wandering if anyone has fixed or had a workaround to this error??

I can insert a link directing to a newly created quiz but does not track student answers etc. If anyone has worked around this problem whatever it is please help!

Many regards,

Ali.

Als Antwort auf Ali Hastie

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Shail Jai -

Hi ... 

i am also facing the same problem , in my case i want simple url (wiht http://) in case of lane user (internate )

and with https:// in case of external user i.e. internet ... 

in case of lane use it works perfectly but in case of external user it show error in case of quiz , and also in case of editing any user's profile ..... 

if any one get any type of idea please share with me .... 

i think so moodle guys know  how to resoleve the issue .....

thanks in advance 

Als Antwort auf Shail Jai

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Sandeep Gill -
Nutzerbild von Plugin developers

Hi Shailesh,

What is the url of of your installation?

Als Antwort auf Sandeep Gill

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Shail Jai -
Hello Sandeep, 

my installation path is : http://172.0.0.1/Moodle ... which is on lane ....

and it's work perfetly for lane user , but i want to publish this site on internet too , for this we are using https://secure.com/Moodle (10.10.xx.yy this ip is pointing to moodle)

in short we are using two differnet wwwroot path for moodle (i read this one from here only)

if($_SERVER["HTTP_HOST"]=='localhost')
{
$CFG->wwwroot = 'http://172.0.0.1/Moodle'; // internal user
}
else
{
$CFG->wwwroot = 'https://172.16.1.21/Moodle'; // external user
}
after this we are facing problem in case of (quiz, user update form , signup form etc.)(external user only i.e. on net)
i don't why such things are happing if whole site can work with https than why not quiz, and user update form , etc. section.

Thanks in advance
Als Antwort auf Shail Jai

Re: Fatal error: Class name must be a valid object or a string in pagelib.php on line 67

von Sandeep Gill -
Nutzerbild von Plugin developers

Hi Shailesh,

You are getting these errors because you are using moodle installation as a directory. The best bet would be to make the changes in the DNS and setup a name instaed of the ip address.

What you need to do is:

1. Create a domain name for your site and set that name as $CFG->wwwroot in the config.php file

2. Internally direct that domain name to your internal ip address

3. Externally direct that domain  to your external ip address

and on the webserver, set the directory root to http://ip-address/moodle and not http://ip-address.

Let me know how you go.

 

Thanks

Sandeep