How to enable FTP for PHP

Introduction

Monsta FTP works out-of-the-box with most PHP hosting environments, however if you run your own web server you may have to enable some PHP extensions which are off by default. Your PHP install must have either the PHP Sockets library (recommended) or the PHP FTP library installed to use FTP connections with Monsta FTP. These can be enabled by editing the php.ini file on your web server.

Prerequisites

Sockets Library

If available, Monsta FTP will prefer to use its own custom FTP functions which are more reliable than the built in PHP FTP functions. This requires enabling the sockets library in your php.ini file.

Linux

On Linux or other *nix systems, the method to enable the socket library depends on the version of PHP and your setup.

You will need to uncomment this line (by removing the initial semicolon):

;extension=sockets.so

The location of the line may be in:

/etc/php/7.0/mods-available/sockets.ini (PHP 7)

or

/etc/php5/mods-available/sockets.ini (PHP 5)

There may be other files depending on your PHP and OS version; to search for the line in all files in /etc, use this command:

grep -r "extension=sockets.so" /etc

Windows

On Windows, this file is usually at C:\Windows\php.ini. Uncomment this line (by removing the initial semicolon):

;extension=php_sockets.dll

For more information, see the PHP documentation at http://php.net/manual/en/book.sockets.php

FTP Library

As mentioned above, the recommend method for FTP connection is to use the socket library, but if this is unavailable you will need to enable the FTP library instead.

The instructions are the same as the above, however you will need to uncomment the ftp extension line in the file instead of the socket extension line.

Linux

On Linux or other *nix systems, uncomment this line:

;extension=ftp.so

Windows

On Windows, uncomment this line:

;extension=php_ftp.dll

For more information, see PHP's documentation.