You are not logged in.

#1 2011-02-08 17:22:51

chsims1
Member
From: Holderness, UK
Registered: 2008-11-25
Posts: 83

[SOLVED] PHP Newbie Help: ftp file download

Hi,

I am trying to modify a php script which downloads a text file from a website. My modified script, simply replaces 'http' with 'ftp' in line 4 below, and obviously the host/path are different.

function get_taf($icao) {
$host = 'tgftp.nws.noaa.gov';
    $path = '/data/forecasts/shorttaf/stations/';
    $rawfile = 'ftp://' . $host . $path . $icao . '.TXT';
    $res = '';
    $res = file($rawfile);

Unfortunately, this gives the error: "Warning: file() [function.file]: connect() failed: Connection timed out in" at the last line of the code above. If I simply type in the contents of $rawfile into my browser address bar, then back comes the expected text immediately.

I am pretty sure that this is probably something very basic here, but I do not have the knowledge of php to know what.  Help please?

Last edited by chsims1 (2011-02-11 14:10:20)

Offline

#2 2011-02-08 20:11:23

iFSS
Member
Registered: 2011-01-29
Posts: 33

Re: [SOLVED] PHP Newbie Help: ftp file download

Are you behind a firewall? If so, you might need to send a PASV command to the server to enable passive mode.

It can be done with the ftp extension: enable the ftp extension in /etc/php/php.ini, restart php (or Apache etc), and see http://uk2.php.net/manual/en/function.ftp-pasv.php. It will probably be easiest for you to get the file with the ftp functions, before using file(), if you really need the file as an array.

Otherwise, you could try using curl instead: http://uk2.php.net/manual/en/book.curl.php (passive by default iirc)

Offline

#3 2011-02-09 09:12:45

chsims1
Member
From: Holderness, UK
Registered: 2008-11-25
Posts: 83

Re: [SOLVED] PHP Newbie Help: ftp file download

The php script is on a webhosting site, not on my PC.

Offline

#4 2011-02-09 18:34:26

hjl3
Member
Registered: 2011-01-21
Posts: 13

Re: [SOLVED] PHP Newbie Help: ftp file download

Your code is sound (tested from my own server).

Be sure that PHP has "allow_url_fopen" enabled. I would also take iFSS's advice. Your host may have iptables / their firewalls configured in such a way that you need to use PASV FTP.

Offline

#5 2011-02-09 18:50:37

iFSS
Member
Registered: 2011-01-29
Posts: 33

Re: [SOLVED] PHP Newbie Help: ftp file download

The same applies (probably, you're not giving enough information to guess/conclude anything else).

The file() function will be connecting to the FTP server using active mode, so the FTP server will be trying to initiate the connection to transfer the data. Your webhost is probably using a firewall, or NAT, or something that is preventing the FTP server from making that connection. So you need to use passive mode instead, whereby your server initiates the data connection.

Find out whether your webhost has enabled the ftp or curl extensions (you can check if they are enabled with http://uk2.php.net/manual/en/function.phpinfo.php - also check that allow_url_fopen is 'On' with this, to make sure), then use either method to get the file. You'll find loads more info on curl with php by googling.

* edit - soz hjl3, didn't see your post, am typing mine too slow at the moment (learning to use Dvorak)

Last edited by iFSS (2011-02-09 18:54:48)

Offline

#6 2011-02-10 08:13:58

chsims1
Member
From: Holderness, UK
Registered: 2008-11-25
Posts: 83

Re: [SOLVED] PHP Newbie Help: ftp file download

Thank you both very much.  I'll look into what the host has/has not got enabled.

Edit: allow_url_fopen is definitely on.  I also tried to use cURL (I like this), but with the same result "couldn't connect to host," so looking increasingly likely that it is some sort of restriction from webhost??  They still haven't got back to me about my query.

Last edited by chsims1 (2011-02-10 17:28:26)

Offline

#7 2011-02-11 00:25:42

iFSS
Member
Registered: 2011-01-29
Posts: 33

Re: [SOLVED] PHP Newbie Help: ftp file download

chsims1 wrote:

Edit: allow_url_fopen is definitely on.  I also tried to use cURL (I like this), but with the same result "couldn't connect to host," so looking increasingly likely that it is some sort of restriction from webhost??  They still haven't got back to me about my query.

If you have got the hang of curl, try a test of accessing a remote file over http using it (the url in your 1st post is a good candidate) - if no joy, then your host may be blocking any outgoing connections (so time to find a new host). If it works, at least it is narrowed down to an ftp problem, and other things can be tried.

Offline

#8 2011-02-11 10:19:09

chsims1
Member
From: Holderness, UK
Registered: 2008-11-25
Posts: 83

Re: [SOLVED] PHP Newbie Help: ftp file download

I did indeed try using curl to get the file, but couldn't connect.

I have just tried ftping onto my webhost server, and then ftping from there to the server that I am interested in.  It worked fine, so I can conclude that outgoing ftp is not blocked by the webhost.  Now, I really am confused sad

Offline

#9 2011-02-11 10:42:04

iFSS
Member
Registered: 2011-01-29
Posts: 33

Re: [SOLVED] PHP Newbie Help: ftp file download

chsims1 wrote:

I did indeed try using curl to get the file, but couldn't connect.

Just to clarify - curl isn't working for files over http as well as ftp?

How about ftp://mirrors.uk2.net/pub/archlinux/iso … d5sums.txt / http://archlinux.mirrors.uk2.net/iso/latest/md5sums.txt - do either of those work with your curl script on the web server?

* edit, also try a simple script like

<?php 
$http = file_get_contents('http://archlinux.mirrors.uk2.net/iso/latest/md5sums.txt');
echo "http:\n $http \n\n";

$ftp = file_get_contents('ftp://mirrors.uk2.net/pub/archlinux/iso/2010.05/md5sums.txt');
echo "ftp:\n $ftp";

Last edited by iFSS (2011-02-11 10:47:45)

Offline

#10 2011-02-11 11:09:21

chsims1
Member
From: Holderness, UK
Registered: 2008-11-25
Posts: 83

Re: [SOLVED] PHP Newbie Help: ftp file download

I didn't try curl with http because an earlier part of my script successfully deals with an http site. So, I presume that curl will work fine too.

Using your script the http get works fine, the ftp failed to open a stream. 

This looks like ftp is being blocked, which is why I was so surprised that I could ftp out from my webhost.

Edit: just to be sure, tried curl for http site & works fine.

Here's the phpinfo from the webhost; anything here that could be stopping this working (apologies for length)?

PHP Version 5.2.14

System     Linux thyme 2.6.27.54-smp #1 SMP Mon Oct 4 19:06:37 GMT 2010 i686
Build Date     Oct 9 2010 18:15:03
Configure Command     './configure' '--prefix=/usr' '--with-apxs2=/usr/sbin/apxs' '--prefix=/usr' '--sysconfdir=/etc' '--with-config-file-path=/etc/httpd' '--with-layout=PHP' '--disable-debug' '--disable-static' '--disable-safe-mode' '--disable-magic-quotes' '--enable-xml' '--enable-simplexml' '--enable-hash' '--enable-mbstring' '--with-db4=/usr' '--with-mcrypt=shared' '--enable-bcmath' '--enable-sockets' '--with-curl=shared' '--enable-wddx=shared' '--with-regex=php' '--with-pcre-regex' '--with-bz2=shared,/usr' '--with-zlib=shared,/usr' '--enable-calendar=shared' '--with-openssl=shared' '--with-gettext=shared,/usr' '--enable-exif=shared' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-freetype-dir=/usr' '--with-ttf' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-mysql=shared,/usr/local/mysql' '--with-mysqli=shared,/usr/local/mysql/bin/mysql_config'
Server API     Apache 2.0 Handler
Virtual Directory Support     disabled
Configuration File (php.ini) Path     /etc/httpd
Loaded Configuration File     /etc/httpd/php.ini
Scan this dir for additional .ini files     (none)
additional .ini files parsed     (none)
PHP API     20041225
PHP Extension     20060613
Zend Extension     220060519
Debug Build     no
Thread Safety     disabled
Zend Memory Manager     enabled
IPv6 Support     enabled
Registered PHP Streams     php, file, data, http, ftp, compress.bzip2, https, ftps, compress.zlib
Registered Stream Socket Transports     tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters     convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, bzip2.*, zlib.*

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

PHP Credits
Configuration
PHP Core
Directive    Local Value    Master Value
allow_call_time_pass_reference    Off    Off
allow_url_fopen    On    On
allow_url_include    Off    Off
always_populate_raw_post_data    Off    Off
arg_separator.input    &    &
arg_separator.output    &    &
asp_tags    Off    Off
auto_append_file    no value    no value
auto_globals_jit    On    On
auto_prepend_file    no value    no value
browscap    no value    no value
default_charset    no value    no value
default_mimetype    text/html    text/html
define_syslog_variables    Off    Off
disable_classes    no value    no value
disable_functions    shell_exec,system,exec,passthru,symlink,link,
dl,set_time_limit,popen,show_source,proc_open,
proc_close,proc_get_status,proc_nice,proc_terminate    shell_exec,system,exec,passthru,symlink,link,
dl,set_time_limit,popen,show_source,proc_open,
proc_close,proc_get_status,proc_nice,proc_terminate
display_errors    On    On
display_startup_errors    Off    Off
doc_root    no value    no value
docref_ext    no value    no value
docref_root    no value    no value
enable_dl    Off    Off
error_append_string    no value    no value
error_log    no value    no value
error_prepend_string    no value    no value
error_reporting    6135    6135
expose_php    On    On
extension_dir    /usr/lib/php/extensions/    /usr/lib/php/extensions/
file_uploads    On    On
highlight.bg    #FFFFFF    #FFFFFF
highlight.comment    #FF8000    #FF8000
highlight.default    #0000BB    #0000BB
highlight.html    #000000    #000000
highlight.keyword    #007700    #007700
highlight.string    #DD0000    #DD0000
html_errors    On    On
ignore_repeated_errors    Off    Off
ignore_repeated_source    Off    Off
ignore_user_abort    Off    Off
implicit_flush    Off    Off
include_path    .:/usr/lib/php    .:/usr/lib/php
log_errors    On    On
log_errors_max_len    1024    1024
magic_quotes_gpc    Off    Off
magic_quotes_runtime    Off    Off
magic_quotes_sybase    Off    Off
mail.force_extra_parameters    no value    no value
max_execution_time    30    30
max_file_uploads    20    20
max_input_nesting_level    64    64
max_input_time    30    30
memory_limit    32M    32M
open_basedir    /virtual/users/e15821:/tmp:/usr/lib/php    no value
output_buffering    4096    4096
output_handler    no value    no value
post_max_size    8M    8M
precision    14    14
realpath_cache_size    16K    16K
realpath_cache_ttl    120    120
register_argc_argv    Off    Off
register_globals    Off    Off
register_long_arrays    Off    Off
report_memleaks    On    On
report_zend_debug    On    On
safe_mode    Off    Off
safe_mode_exec_dir    no value    no value
safe_mode_gid    Off    Off
safe_mode_include_dir    no value    no value
sendmail_from    no value    no value
sendmail_path    /usr/sbin/sendmail -t -i -f webmaster@thesutherlands.co.uk    /usr/sbin/sendmail -t -i 
serialize_precision    100    100
short_open_tag    On    On
SMTP    localhost    localhost
smtp_port    25    25
sql.safe_mode    Off    Off
track_errors    Off    Off
unserialize_callback_func    no value    no value
upload_max_filesize    4M    4M
upload_tmp_dir    /tmp    /tmp
user_dir    no value    no value
variables_order    GPCS    GPCS
xmlrpc_error_number    0    0
xmlrpc_errors    Off    Off
y2k_compliance    On    On
zend.ze1_compatibility_mode    Off    Off

apache2handler
Apache Version     Apache
Apache API Version     20051115
Server Administrator     webmaster@thesutherlands.co.uk
Hostname:Port     thesutherlands.co.uk:0
User/Group     nobody(99)/98
Max Requests     Per Child: 0 - Keep Alive: on - Max Per Connection: 30
Timeouts     Connection: 30 - Keep-Alive: 15
Virtual Server     Yes
Server Root     /usr
Loaded Modules     core prefork http_core mod_so mod_authn_file mod_authn_dbm mod_authn_anon mod_authn_dbd mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_dbm mod_authz_owner mod_authz_default mod_auth_basic mod_auth_digest mod_dbd mod_dumpio mod_reqtimeout mod_ext_filter mod_include mod_filter mod_substitute mod_deflate mod_log_config mod_log_forensic mod_logio mod_env mod_mime_magic mod_expires mod_headers mod_ident mod_usertrack mod_unique_id mod_setenvif mod_version mod_ssl mod_mime mod_dav mod_status mod_autoindex mod_asis mod_info mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_imagemap mod_actions mod_alias mod_rewrite mod_php5

Directive    Local Value    Master Value
engine    1    1
last_modified    0    0
xbithack    0    0

Apache Environment
Variable    Value
UNIQUE_ID     TVUeC0o07TsAAApjRe0AAAAX
HTTP_HOST     thesutherlands.co.uk
HTTP_USER_AGENT     Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101216 Firefox/3.6.13
HTTP_ACCEPT     text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_LANGUAGE     en-us,en;q=0.5
HTTP_ACCEPT_ENCODING     gzip,deflate
HTTP_ACCEPT_CHARSET     ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_KEEP_ALIVE     115
HTTP_CONNECTION     keep-alive
HTTP_COOKIE     __utma=220720477.692680101.1295713305.1297411511.1297422264.57; __utmz=220720477.1297422264.57.57.utmcsr=ig.gmodules.com|utmccn=(referral)|utmcmd=referral|utmcct=/gadgets/ifr; __utmc=220720477; __utmb=220720477.5.10.1297422264
PATH     /bin:/usr/bin:/sbin:/usr/sbin
SERVER_SIGNATURE     no value
SERVER_SOFTWARE     Apache
SERVER_NAME     thesutherlands.co.uk
SERVER_ADDR     74.52.237.59
SERVER_PORT     80
REMOTE_ADDR     83.100.132.29
DOCUMENT_ROOT     /virtual/users/e15821-16740/web
SERVER_ADMIN     webmaster@thesutherlands.co.uk
SCRIPT_FILENAME     /virtual/users/e15821-16740/web/test.php
REMOTE_PORT     52146
GATEWAY_INTERFACE     CGI/1.1
SERVER_PROTOCOL     HTTP/1.1
REQUEST_METHOD     GET
QUERY_STRING     no value
REQUEST_URI     /test.php
SCRIPT_NAME     /test.php

HTTP Headers Information
HTTP Request Headers
HTTP Request     GET /test.php HTTP/1.1
Host     thesutherlands.co.uk
User-Agent     Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101216 Firefox/3.6.13
Accept     text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language     en-us,en;q=0.5
Accept-Encoding     gzip,deflate
Accept-Charset     ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive     115
Connection     keep-alive
Cookie     __utma=220720477.692680101.1295713305.1297411511.1297422264.57; __utmz=220720477.1297422264.57.57.utmcsr=ig.gmodules.com|utmccn=(referral)|utmcmd=referral|utmcct=/gadgets/ifr; __utmc=220720477; __utmb=220720477.5.10.1297422264
HTTP Response Headers
X-Powered-By     PHP/5.2.14
Keep-Alive     timeout=15, max=29
Connection     Keep-Alive
Transfer-Encoding     chunked
Content-Type     text/html

bcmath
BCMath support     enabled

bz2
BZip2 Support     Enabled
Stream Wrapper support     compress.bz2://
Stream Filter support     bzip2.decompress, bzip2.compress
BZip2 Version     1.0.5, 10-Dec-2007

calendar
Calendar support     enabled

ctype
ctype functions     enabled

curl
cURL support     enabled
cURL Information     libcurl/7.19.6 OpenSSL/0.9.8n zlib/1.2.3 libidn/1.5

date
date/time support     enabled
"Olson" Timezone Database Version     2010.9
Timezone Database     internal
Default timezone     UTC

Directive    Local Value    Master Value
date.default_latitude    31.7667    31.7667
date.default_longitude    35.2333    35.2333
date.sunrise_zenith    90.583333    90.583333
date.sunset_zenith    90.583333    90.583333
date.timezone    no value    no value

dba
DBA support     enabled
Supported handlers     cdb cdb_make db4 inifile flatfile

dom
DOM/XML     enabled
DOM/XML API Version     20031129
libxml Version     2.6.32
HTML Support     enabled
XPath Support     enabled
XPointer Support     enabled
Schema Support     enabled
RelaxNG Support     enabled

exif
EXIF Support     enabled
EXIF Version     1.4 $Id: exif.c 293036 2010-01-03 09:23:27Z sebastian $
Supported EXIF Version     0220
Supported filetypes     JPEG,TIFF

filter
Input Validation and Filtering     enabled
Revision     $Revision: 298196 $

Directive    Local Value    Master Value
filter.default    unsafe_raw    unsafe_raw
filter.default_flags    no value    no value

gd
GD Support     enabled
GD Version     bundled (2.0.34 compatible)
FreeType Support     enabled
FreeType Linkage     with freetype
FreeType Version     2.3.7
GIF Read Support     enabled
GIF Create Support     enabled
JPG Support     enabled
PNG Support     enabled
WBMP Support     enabled
XBM Support     enabled

gettext
GetText Support     enabled

hash
hash support     enabled
Hashing Engines     md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5

iconv
iconv support     enabled
iconv implementation     glibc
iconv library version     2.7

Directive    Local Value    Master Value
iconv.input_encoding    ISO-8859-1    ISO-8859-1
iconv.internal_encoding    ISO-8859-1    ISO-8859-1
iconv.output_encoding    ISO-8859-1    ISO-8859-1

json
json support     enabled
json version     1.2.1

libxml
libXML support     active
libXML Version     2.6.32
libXML streams     enabled

mbstring
Multibyte Support     enabled
Multibyte string engine     libmbfl
Multibyte (japanese) regex support     enabled
Multibyte regex (oniguruma) version     4.4.4
Multibyte regex (oniguruma) backtrack check     On

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

Directive    Local Value    Master Value
mbstring.detect_order    no value    no value
mbstring.encoding_translation    Off    Off
mbstring.func_overload    0    0
mbstring.http_input    pass    pass
mbstring.http_output    pass    pass
mbstring.internal_encoding    no value    no value
mbstring.language    neutral    neutral
mbstring.strict_detection    Off    Off
mbstring.substitute_character    no value    no value

mcrypt
mcrypt support    enabled
Version     2.5.8
Api No     20021217
Supported ciphers     cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes     cbc cfb ctr ecb ncfb nofb ofb stream

Directive    Local Value    Master Value
mcrypt.algorithms_dir    no value    no value
mcrypt.modes_dir    no value    no value

mysql
MySQL Support    enabled
Active Persistent Links     0
Active Links     0
Client API version     5.1.51
MYSQL_MODULE_TYPE     external
MYSQL_SOCKET     /tmp/mysql.sock
MYSQL_INCLUDE     -I/usr/local/mysql/include
MYSQL_LIBS     -L/usr/local/mysql/lib -lmysqlclient

Directive    Local Value    Master Value
mysql.allow_persistent    Off    Off
mysql.connect_timeout    60    60
mysql.default_host    no value    no value
mysql.default_password    no value    no value
mysql.default_port    no value    no value
mysql.default_socket    no value    no value
mysql.default_user    no value    no value
mysql.max_links    Unlimited    Unlimited
mysql.max_persistent    Unlimited    Unlimited
mysql.trace_mode    Off    Off

mysqli
MysqlI Support    enabled
Client API library version     5.1.51
Client API header version     5.1.51
MYSQLI_SOCKET     /tmp/mysql.sock

Directive    Local Value    Master Value
mysqli.default_host    no value    no value
mysqli.default_port    3306    3306
mysqli.default_pw    no value    no value
mysqli.default_socket    no value    no value
mysqli.default_user    no value    no value
mysqli.max_links    Unlimited    Unlimited
mysqli.reconnect    Off    Off

openssl
OpenSSL support     enabled
OpenSSL Version     OpenSSL 0.9.8n 24 Mar 2010

pcre
PCRE (Perl Compatible Regular Expressions) Support     enabled
PCRE Library Version     8.02 2010-03-19

Directive    Local Value    Master Value
pcre.backtrack_limit    100000    100000
pcre.recursion_limit    100000    100000

PDO
PDO support    enabled
PDO drivers     sqlite, sqlite2

pdo_sqlite
PDO Driver for SQLite 3.x    enabled
PECL Module version     (bundled) 1.0.1 $Id: pdo_sqlite.c 293036 2010-01-03 09:23:27Z sebastian $
SQLite Library     3.3.7

posix
Revision     $Revision: 293036 $

Reflection
Reflection    enabled
Version     $Id: php_reflection.c 300129 2010-06-03 00:43:37Z felipe $

session
Session Support     enabled
Registered save handlers     files user sqlite
Registered serializer handlers     php php_binary wddx

Directive    Local Value    Master Value
session.auto_start    Off    Off
session.bug_compat_42    Off    Off
session.bug_compat_warn    On    On
session.cache_expire    180    180
session.cache_limiter    nocache    nocache
session.cookie_domain    no value    no value
session.cookie_httponly    Off    Off
session.cookie_lifetime    0    0
session.cookie_path    /    /
session.cookie_secure    Off    Off
session.entropy_file    no value    no value
session.entropy_length    0    0
session.gc_divisor    1000    1000
session.gc_maxlifetime    1440    1440
session.gc_probability    1    1
session.hash_bits_per_character    5    5
session.hash_function    0    0
session.name    PHPSESSID    PHPSESSID
session.referer_check    no value    no value
session.save_handler    files    files
session.save_path    /tmp    /tmp
session.serialize_handler    php    php
session.use_cookies    On    On
session.use_only_cookies    Off    Off
session.use_trans_sid    0    0

SimpleXML
Simplexml support    enabled
Revision     $Revision: 299016 $
Schema support     enabled

sockets
Sockets Support     enabled

SPL
SPL support    enabled
Interfaces     Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes     AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RegexIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException

SQLite
SQLite support    enabled
PECL Module version     2.0-dev $Id: sqlite.c 298697 2010-04-28 12:10:10Z iliaa $
SQLite Library     2.8.17
SQLite Encoding     iso8859

Directive    Local Value    Master Value
sqlite.assoc_case    0    0

standard
Regex Library     Bundled library enabled
Dynamic Library Support     enabled
Path to sendmail     /usr/sbin/sendmail -t -i -f webmaster@thesutherlands.co.uk

Directive    Local Value    Master Value
assert.active    1    1
assert.bail    0    0
assert.callback    no value    no value
assert.quiet_eval    0    0
assert.warning    1    1
auto_detect_line_endings    0    0
default_socket_timeout    60    60
safe_mode_allowed_env_vars    PHP_    PHP_
safe_mode_protected_env_vars    LD_LIBRARY_PATH    LD_LIBRARY_PATH
url_rewriter.tags    a=href,area=href,frame=src,input=src,form=fakeentry    a=href,area=href,frame=src,input=src,form=fakeentry
user_agent    no value    no value

tokenizer
Tokenizer Support     enabled

wddx
WDDX Support    enabled
WDDX Session Serializer     enabled

xml
XML Support     active
XML Namespace Support     active
libxml2 Version     2.6.32

xmlreader
XMLReader     enabled

xmlwriter
XMLWriter     enabled

zlib
ZLib Support     enabled
Stream Wrapper support     compress.zlib://
Stream Filter support     zlib.inflate, zlib.deflate
Compiled Version     1.2.3
Linked Version     1.2.3

Directive    Local Value    Master Value
zlib.output_compression    Off    Off
zlib.output_compression_level    -1    -1
zlib.output_handler    no value    no value

Additional Modules
Module Name

Environment
Variable    Value
CONSOLE     /dev/console
TERM     linux
SHELL     /bin/sh
USER     root
LD_LIBRARY_PATH     /usr/lib/httpd:
INIT_VERSION     sysvinit-2.86
PATH     /bin:/usr/bin:/sbin:/usr/sbin
RUNLEVEL     3
PWD     /root
PREVLEVEL     N
SHLVL     5
HOME     /root
_     /usr/sbin/httpd

PHP Variables
Variable    Value
_REQUEST["__utma"]    220720477.692680101.1295713305.1297411511.1297422264.57
_REQUEST["__utmz"]    220720477.1297422264.57.57.utmcsr=ig.gmodules.com|utmccn=(referral)|utmcmd=referral|utmcct=/gadgets/ifr
_REQUEST["__utmc"]    220720477
_REQUEST["__utmb"]    220720477.5.10.1297422264
_COOKIE["__utma"]    220720477.692680101.1295713305.1297411511.1297422264.57
_COOKIE["__utmz"]    220720477.1297422264.57.57.utmcsr=ig.gmodules.com|utmccn=(referral)|utmcmd=referral|utmcct=/gadgets/ifr
_COOKIE["__utmc"]    220720477
_COOKIE["__utmb"]    220720477.5.10.1297422264
_SERVER["UNIQUE_ID"]    TVUeC0o07TsAAApjRe0AAAAX
_SERVER["HTTP_HOST"]    thesutherlands.co.uk
_SERVER["HTTP_USER_AGENT"]    Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101216 Firefox/3.6.13
_SERVER["HTTP_ACCEPT"]    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
_SERVER["HTTP_ACCEPT_LANGUAGE"]    en-us,en;q=0.5
_SERVER["HTTP_ACCEPT_ENCODING"]    gzip,deflate
_SERVER["HTTP_ACCEPT_CHARSET"]    ISO-8859-1,utf-8;q=0.7,*;q=0.7
_SERVER["HTTP_KEEP_ALIVE"]    115
_SERVER["HTTP_CONNECTION"]    keep-alive
_SERVER["HTTP_COOKIE"]    __utma=220720477.692680101.1295713305.1297411511.1297422264.57; __utmz=220720477.1297422264.57.57.utmcsr=ig.gmodules.com|utmccn=(referral)|utmcmd=referral|utmcct=/gadgets/ifr; __utmc=220720477; __utmb=220720477.5.10.1297422264
_SERVER["PATH"]    /bin:/usr/bin:/sbin:/usr/sbin
_SERVER["SERVER_SIGNATURE"]    no value
_SERVER["SERVER_SOFTWARE"]    Apache
_SERVER["SERVER_NAME"]    thesutherlands.co.uk
_SERVER["SERVER_ADDR"]    74.52.237.59
_SERVER["SERVER_PORT"]    80
_SERVER["REMOTE_ADDR"]    83.100.132.29
_SERVER["DOCUMENT_ROOT"]    /virtual/users/e15821-16740/web
_SERVER["SERVER_ADMIN"]    webmaster@thesutherlands.co.uk
_SERVER["SCRIPT_FILENAME"]    /virtual/users/e15821-16740/web/test.php
_SERVER["REMOTE_PORT"]    52146
_SERVER["GATEWAY_INTERFACE"]    CGI/1.1
_SERVER["SERVER_PROTOCOL"]    HTTP/1.1
_SERVER["REQUEST_METHOD"]    GET
_SERVER["QUERY_STRING"]    no value
_SERVER["REQUEST_URI"]    /test.php
_SERVER["SCRIPT_NAME"]    /test.php
_SERVER["PHP_SELF"]    /test.php
_SERVER["REQUEST_TIME"]    1297423883

Last edited by chsims1 (2011-02-11 11:35:56)

Offline

#11 2011-02-11 11:40:00

iFSS
Member
Registered: 2011-01-29
Posts: 33

Re: [SOLVED] PHP Newbie Help: ftp file download

That definitely looks like the host is the problem then, if ftp doesn't work for scripts at all (most likely their firewall config, or possibly a proxy?) - see if they get back to your query & will resolve the issue.

Failing that (& if you can't change hosts), contact the admin of the ftp server that you are connecting to, to find out if the file can be accessed over http somewhere. If not, and no other option, look into accessing the file using a web ftp client/proxy service - though you'll have to be 100% certain of their trustworthiness.

* edit - the settings seem fine, ftp streams should work

Last edited by iFSS (2011-02-11 11:53:34)

Offline

#12 2011-02-11 14:11:20

chsims1
Member
From: Holderness, UK
Registered: 2008-11-25
Posts: 83

Re: [SOLVED] PHP Newbie Help: ftp file download

Thanks for all the help, the webhost has confirmed it is not possible to ftp a remote site from a script.  I will have to think again.

Offline

Board footer

Powered by FluxBB