Question

I run into strange issue that I cannot debug. Same code works fine on different servers, but on Amazon instance - not. Especially, ftp_connect() doesn't work.

<?php
error_reporting(E_ALL);

$conn = ftp_connect("server.address");

var_dump($conn);

$login_result = ftp_login ($conn, "username", "pass");
?>

Output: bool(false) Warning: ftp_login() expects parameter 1 to be resource, boolean given in /var/www/dev/ftp/index.php on line 8

I'm able to connect to this ftp server from command line so it's not any global firewall. ftp_connect() just giving me false and that's it. It's starting to show warnings if I try to connect to non-existing address, but for existing - only silence and false. Do you have any ideas how to debug it?

Was it helpful?

Solution

Check if it running from console. If everything is ok, install Apache 2 ITK MPM and add to VirtualHost:

ServerName example.com DocumentRoot /path/to/web/root

AssignUserId vhost-user vhost-group

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top