简体   繁体   中英

How do I connect to localhost via ftp wth PHP?

Should be an easy question but I don't really have an understanding of how servers work. I am using MAMP/Apache and I'm trying to use this command on PHP:

$conn_id=ftp_connect($ftp_server);

then,

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

It works to type in my URL, username and password to connect to the remote server hosted on dreamhost, but how do I connect to the local host for testing purposes? What exactly is my server called? And what do I put for username and password?

Thanks!

MAMP doesn't come with a built-in FTP server. If you want to simulate a FTP connection locally, you can use the FTP server that comes with OS X. MAMP does offer a step by step tutorial how to use it:

How to: Access FTP with MAMP

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