Search code examples
phpftpfopen

fopen ftp:// wrapper is disabled


I try to create a file on a remote server and write something in but every time i get the error:

Warning (2): fopen(): ftp:// wrapper is disabled in the server
configuration by allow_url_fopen=0 Warning (2):
fopen(ftp://...@log/TEST/CONFIG/test.proc) [function.fopen]: failed
to open stream: no suitable wrapper could be found

I try on local server and it works well but when I try on my prod server (my prod server and the remote server where i try to create/write the file are different) i got the error above.

In both php.ini :

allow_url_fopen= On

i do :

$path = "ftp://login:pass@IP/TEST/CONFIG/" . $name; // $name = test.proc
$dest = fopen($path, "w");

Which mistake could I have done that prevents it from working? How can I fix this?

EDIT: in phpinfo(), allow_url_fopen is turned off (global and local), why ? (i'm using cakephp framework, maybe ? and the server where allow_url_fopen is set at off every time is hosted by OVH)


Solution

  • I actually check the files in /etc/php5/apache2/conf.d and security.ini was overwriting some rules of my php.ini including allow_url_fopen. Thank you for your time and help.