2

I would like to host az FTP server on: mywebsite.domain/ftpserver.php

The XAMPP server runs on my computer. The php is important, because I would like to authenticate the users using their passwords in the mysql database, and their directory's name is also stored in the database.

Or if there is a free ftp server, then how could I create ftp users from the php?

2
  • Is it important that it actually uses the FTP protocol, or would any old file storage system do? Commented Aug 29, 2014 at 11:48
  • Why can't you just run ftpd? Or do you want file upload/download from a web browser? Commented Aug 29, 2014 at 11:50

2 Answers 2

7

I know that this question is some years old, but for my opinion, the accepted answer is not correct.

You can omit the webserver (XAMPP / Apache) and run a PHP script from command line. This PHP scripts can listen to a tcp port (e. g. port 22, https://www.php.net/manual/en/function.socket-listen.php) and so it can receive (FTP) requests directly from a client. You will reach the server via mywebsite.domain. mywebsite.domain/yourscript.php is not necessary because PHP will listen directly to the given port.

But there's a big backdraw: You have to implement the complete FTP protocol by yourself in PHP. And that's a quite big task and you have to know what you do.

Sign up to request clarification or add additional context in comments.

Comments

2

This can not easily be done. PHP works, almost always, with a webserver, serving HTTP and HTTPS request, not FTP requests. You could configure it to answer to FTP requests on port 22, as said in the other answer, but then you still have to process all the FTP requests.

A second point would be; Why FTP? You can serve files with the HTTP and HTTPS protocol as well. The only limitation is that users cannot use a custom client, they have to use a browser.

2 Comments

This answer is wrong: it can be done.
@GeorgyIvanov This is a very old answer, but if it is wrong it deserves correcting. read...read...read. I agree that the first sentence of the answer is too absolute, I will change it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.