简体   繁体   中英

Php ftp_connect doesen't work on AWS server

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM