Fatal Error:

I keep getting Fatal error: Call to undefined function Ftp() in C:\wamp\www\Work\ftp_test.php on line 4 when i run the following script.


<?php
include 'includes/Ftp.php';
Ftp('ftp.server.com','username','password',$port='21',$connect=true,$check_remotely_for_items=true,$output_actions=false);
?>

I know it means that it can’t find the included file, but I am not sure why…

The file Ftp.php is in a folder marked ‘includes’ inside the same folder as ftp_test.php. Anyone have any ideas as to why this is occurring?

From what i can see the original code is fine but the function your calling doesn’t exist, make sure the function name matches as they are case sensitive i believe

I now get two new errors before the original one:

Warning: include(dirname(FILE)./includes/Ftp.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\Work\ftp_test.php on line 2

Warning: include() [function.include]: Failed opening ‘dirname(FILE)./includes/Ftp.php’ for inclusion (include_path=‘.;C:\php5\pear’) in C:\wamp\www\Work\ftp_test.php on line 2

Ftp.php is the correct file name. I even copied it directly from the file to make sure.

Here is the include path from the php.ini file
include_path = “.;c:\php\includes”

how about dirname(FILE).‘/includes/Ftp.php’; ?

If that doesn’t work I’m sure the file doesn’t exist.
Btw, is it really Ftp.php? Or is is ftp.php, or something else? - case matters (well, on *nix boxes anyway)

No, same error

It seems to me that . is not set in the include_path directive of php.ini

Does it work if you do include './includes/Ftp.php'; ?

You both were right. The function I was trying to call was within a class. I started a ‘new’ instance of class and it ran.

Thank you both for the help