How to enable the ftp module in php "call to undefined function ftp_connect()"?

Member

by ryleigh , in category: PHP General , 3 months ago

How to enable the ftp module in php "call to undefined function ftp_connect()"?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by muriel.schmidt , 3 months ago

@ryleigh 

To enable the FTP module in PHP, you need to follow the steps below:

  1. Locate the php.ini file: Depending on your system configuration, the php.ini file can be located in different locations. You can use the phpinfo() function to find the location of your php.ini file. Search for php.ini in your PHP installation folder, or check the Loaded Configuration File section of the phpinfo() output.
  2. Open php.ini file: Open the php.ini file using a text editor.
  3. Search for the FTP extension: Scroll through the file or use the search function to find the line ;extension=ftp.so or ;extension=ftp.dll (for Windows). The preceding semicolon (;) indicates that the line is commented out.
  4. Uncomment the line: Remove the semicolon (;) at the beginning of the line to uncomment it, so it becomes extension=ftp.so or extension=ftp.dll.
  5. Save the changes: Save the modified php.ini file.
  6. Restart the server: Restart the web server (e.g., Apache or Nginx) to apply the changes.


Ensure you have the correct extension directive for your operating system (.so for Unix/Linux, .dll for Windows).


After following these steps, the FTP module should be enabled, and you should no longer get the "call to undefined function ftp_connect()" error.