PHP problem


#1

I’ve loaded an index.php file and a file named user_functions.php to my web directory. The first line of index.php is:

<?php require_once('user_functions.php');?>

If I access it, I get the following errors:

Warning: main(user_functions.php): failed to open stream: No such file or directory in /home/.katsumi/hmessing/spanishmentor.com/index.php on line 1

Fatal error: main(): Failed opening required ‘user_functions.php’ (include_path=’.:/usr/local/lib/php’) in /home/.katsumi/hmessing/spanishmentor.com/index.php on line 1

Excuse me if this is something obvious…but can someone explain what is going on here…thanks.


#2

Are both of your files placed within the same spanishmentor.com directory? I see that index is present, but if you go to http://spanishmentor.com/user_functions.php I get a 404 error saying that the file isn’t actually there. make sure it’s uploaded to the correct place, and that the name matches (remember that linux servers are CaseSensitiVe)

Hope this helps

-Matttail


#3

Oops…embarassing…loaded wrong file and the katsumi threw me…ok now…

What is the .katsumi business anyway?


#4

[quote]Oops…embarassing…loaded wrong file and the katsumi threw me…ok now…

What is the .katsumi business anyway?[/quote]
You can guarantee your includes work from anywhere by including them like this:<?php require_once($_SERVER['DOCUMENT_ROOT'].'/includes/include.php');?>That assumes you have the file in an “includes” directory in your web root (http://domain.com/includes/). It saves you from having to monkey around with relative paths.

.katsumi is the name of the server you happen to be on. Do not hard-code this, because it may change from time to time. It can be safely left out, like this:/home/hmessing/spanishmentor.com/----------------
Simon Jessey
Keystone Websites (business site) | si-blog (personal site with affiliate links)