Configure FTP Access

Documentation

Configure FTP Access

XAMPP includes the server version of FileZilla, an open-source FTP solution. This makes it easy to transfer files to and from a XAMPP environment using FTP.

To illustrate, assume that you have a simple PHP script named example.php on your Windows desktop containing the following code, that you wish to transfer to the XAMPP server.

<!-- example.php -->
<html>
 <head></head>
 <body>
   <h2><?php echo "Hello. Today is " . date('l'); ?>.</h2>
 </body>
</html>

To transfer files using FTP, you must first configure the FileZilla FTP server. Follow the steps below.

  1. Ensure that FileZilla is running.

  2. Start the FileZilla administration interface by clicking the "Admin" button in the XAMPP control panel.

    image1
  3. In the resulting "Connect to Server" dialog box, leave all values at their default values and click "OK".

    image2

    You should now arrive at the FileZilla server console.

    image3
  4. You now need to set up at least one FTP user. To do this, click the "Edit → Users" menu item. This will bring you to the user management interface.

    image4
  5. Click the "Add" button to add a new user account. Enter a name for the new user account.

    image5
  6. Select and check the "Password" field and enter a password for the new user.

    image6
  7. Next, you need to define which folders the user has access to. To do this, click the "Shared folder" sub-item in the left navigation menu.

  8. Click the "Add" button and select the htdocs\ subdirectory of the XAMPP installation directory as the user’s home directory.

    image7
  9. Grant the user all available rights to this directory.

    image8
  10. Click "OK" to save your changes.

  11. Use the "File → Quit" menu item to disconnect from the FileZilla administration interface.

You can now transfer files to the XAMPP server by following the steps below:

  1. Launch your FTP client and enter connection details as below.

    • If you’re connecting to the server from the same system, use "127.0.0.1" as the host address. If you’re connecting from a different system, use the network hostname or IP address of the XAMPP server.

    • Use "21" as the port.

    • Specify the username and password configured previously as your FTP credentials.

    Your FTP client should now connect to the server and enter the C:\xampp\htdocs directory, which is the default Web server document root.

    image9
  2. Transfer the file from your home directory to the server using normal FTP transfer conventions. If you’re using a graphical FTP client, you can usually drag and drop the file from one directory to the other. If you’re using a command-line FTP client, you can use the FTP PUT command.

    image10
  3. Once the file is successfully transferred, you should be able to see it in action by browsing to http://localhost/example.php, as shown below:

    image11