Jump to content
Larry Ullman's Book Forums

Recommended Posts

I've been trying to complete the exercise in Chapter 6 pertaining to namespaces.(scripts 6.9, 6.10)

When attempting to run the script, I initially received an error like this:

 

Warning: Unexpected character in input: '\' (ASCII=92) state=1;

 

I even tried running the author's scripts and received the same error. After looking on the PHP site for more information, I tried deleting the initial '\' to the first object instantiation at the line number where the error specified:

 

$hr = new MyNamespace\Company\Department('Accounting');

 

This resulted in a blank page. Further tinkering around resulted in an Internal Server Error. Since I'm using a hosting service, I've sent them an inquiry for directions to access the server log. In the meantime, I was wondering if anyone could shed light on this issue. The directory was configured as the book suggested. The version of PHP that I'm using is 5.3.

Link to comment
Share on other sites

It matters a bit. Namespace support was added in 5.3, so at least that's not the problem.

 

Since you got a blank page, try adding these lines to the top of your file:

 

 

<?php
// Display errors
ini_set('display_errors', 1);

// Full error reporting
 error_reporting(-1);

?>
 

Do you get any more information now?

  • Upvote 2
Link to comment
Share on other sites

 Share

×
×
  • Create New...