views:

83

answers:

3

Here's the folder structure of my project:

/ping

--/Controller
----Ping_Conntroller_Main.php
----Ping_Conntroller_Db.php

--/Model
----dbCredentials.php

--/View
----output.html.php

'ping' is the folder that contains my project and it sits inside the 'xampp/htdocs/' directory on my computer (C:/xampplite/htdocs/)

Here is the initial code for each file:

OUTPUT.HTML.PHP
---------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
$root = $_SERVER['DOCUMENT_ROOT'];

include($root.'/ping/Controller/Ping_Controller_Main.php');

PING_CONTROLLER_DB.PHP
----------------------
<?php
$root = $_SERVER['DOCUMENT_ROOT'];

require($root.'/ping/Model/dbCredentials.php');

class Ping_Controller_Db
{

PING_CONTROLLER_MAIN.PHP
------------------------
<?php
$root = $_SERVER['DOCUMENT_ROOT'];

require($root.'/ping/Controller/Ping_Controller_Db.php');

class Ping_Controller_Main
{

These are the errors I get when trying to access the 'output.html.php' file in a browser:

Warning: include(C:/xampplite/htdocs/ping/Controller/Ping_Controller_Main.php) [function.include]: failed to open stream: No such file or directory in C:\xampplite\htdocs\ping\View\output.html.php on line 6

Warning: include() [function.include]: Failed opening 'C:/xampplite/htdocs/ping/Controller/Ping_Controller_Main.php' for inclusion (include_path='.;C:\xampplite\php\PEAR') in C:\xampplite\htdocs\ping\View\output.html.php on line 6

I know I must be doing something really stupid, but I've been staring at the error for the past 20mins and can't seem to get this to work.

Thanks in advance!

+1  A: 

Do the two n's in the names of the actual files (as shown in your folder structure) have anything to do with it?

I'm not sure how to award multiple answers, but your answer is also correct.
Chrys G.
Looks like MartyIX beat me by a nose. He deserves it. :)
+1  A: 

Looks like your files are named "Conntroller" instead of "Controller". If this isn't the problem, you might try using backslashes instead of forward slashes to separate the directories/filenames. I'm not sure if it makes a difference for PHP on Windows, but I know it generally makes a difference on Windows.

Topher Fangio
I'm not sure how to award multiple answers, but your answer is also correct.
Chrys G.
@Chrys G. - You can't really award multiple answers except to vote them up. Generally I pick the most correct answer or, if they are all about the same, the first correct answer.
Topher Fangio
+1  A: 
----Ping_Conntroller_Main.php
----Ping_Conntroller_Db.php

Filenames contain double "n" (CoNNtroller).

MartyIX
Oh good god! I was scouring the source code and completely missed the file name.
Chrys G.
It happens. Props to you for asking for help. A second set of eyes beats pulling out all of your hair.
I was working in Java one day and spent 45 minutes looking at the error that told me the exact line the problem was on. Then, my friend looks over at my screen and says, "You misspelled 'Length'". I had spelled it "Lenth" and I could not figure it out. +1 for an extra set of eyes :-)
Topher Fangio