<html>
<head>
<title> ftp php test page</title>
<?php                  
$ftp_server = "10.209.152.220";
$ftp_user = "deepthisk";
$ftp_pass = "Hatepwd1";

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to ".$ftp_server."\n"); 

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
    echo "Connected as ".$ftp_user."@".$ftp_server."\n";
} else {
    echo "Couldn't connect as ".$ftp_user;
}
echo "Current directory: " . ftp_pwd($conn_id);

// try to change the directory to somedir
if (ftp_chdir($conn_id, "/host/bng-junos-pool82/b/vikramg/nov3/src/junos/lib/liblicense/")) {
    echo "Current directory is now: " . ftp_pwd($conn_id)."\n";
} else { 
    echo "Couldn't change directory\n";
}

// close the connection
ftp_close($conn_id);  
?>
</head>
</html>

This is my code to go to a particular directory to fetch a file through FTP.
This code runs perfectly when i do (RUN DIRECTLY THROUGH PHP)

php ftpphp.php

on my server.....
OUTPUT:

<html>
<head>
<title> ftp php test page</title>
Connected as deepthisk@10.209.152.220
Current directory: /.amd/bng-enghomes001-cf2-5/vol/home5/homes5/deepthiskCurrent directory is now: /.amd/bng-junos-pool82/host/b/vikramg/nov3/src/junos/lib/liblicense
</head>
</html>

but when i try to view it on my browser using apache
nothing is displayed..

pagesource:

<html>
<head>
<title> ftp php test page</title>

this happens only with my ftp functions and my all other mysql functions work brilliantly.

I GUESS THIS IS A BIT OF CONFIGURATION PROBLEM...BUT I CONFIGURED MY PHP WITH FTP ENABLED RECENTLY...WHERE AS WITH MYSQL A LONG TIME AGO...IS IT BECAUSE MY APACHE IS STILL SEEING THE PREVIOUS CONFIGURATION OF PHP...IF SO, WHAT SHOULD I DO?

I have also found out that phpinfo() does not show any ftp enabled with PHP even though i copied the libphp5.so in to APACHE modules and copied the newly compiled php.ini to the path specified in phpinfo()
But however, my php runs the ftp script and gives output without errors.
Please Help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.