Solved No more FTP in PHP 5.4


Staff member
First: I know that PHP 5.4 is end-of-life, but I have a client who is still dependent upon it. I'm slowly migrating them to PHP 5.6 and PHP 7, but on a couple of servers they're still stuck on 5.4.

For some obscure reason, ftp_connect stopped working, apparently because PHP 'magically' lost support for FTP.

  • php5-ftp-5.4.45 is installed (through php5-extensions)
  • The module is listed in /usr/local/etc/php/extensions.ini:
  • The module actually exists:
    -r--r--r--  1 root  wheel  42900 Feb  2  2016 /usr/local/lib/php/20100525/
  • php -i says it loaded the extensions.ini:
Configuration File (php.ini) Path => /usr/local/etc
Loaded Configuration File => /usr/local/etc/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php
Additional .ini files parsed => /usr/local/etc/php/extensions.ini

php -m does not list 'ftp'
php -i does not have a configuration block for 'ftp'.

What else is needed to wedge FTP support back into PHP 5.4? As far as I can see, PHP 5.6 and PHP 7.0 support FTP in almost the exact same way (the only difference being that extensions.ini is replaced by per-module .ini files -- I have tried adding a separate ftp.ini, it gets parsed, but alas).

I can see nothing in php.ini that might toggle FTP support on/off, and the php.ini is unchanged between PHP versions to begin with.

Recompiling is not an option. All compiled packages (from our Poudriere repo) are present, installed, and unchanged.

Any ideas?
And it's solved: the PHP module talks to libssl and libcrypto, and those were updated in the OpenSSL port on Oct 31st.

So, for now:

ln -s /usr/local/lib/ /usr/local/lib/ && ln -s /usr/local/lib/ /usr/local/lib/ && /usr/local/sbin/apachectl restart.

Migration to PHP 5.6 is now proceeding at a faster rate ..

P.S.: I should remember to look into the phperrors log earlier on in the process..