You are here: Re: file which tries to find itself and can't... « PHP Programming Language « IT news, forums, messages
Re: file which tries to find itself and can't...

Posted by Jerry Stuckle on 03/01/06 00:28

julian_m wrote:
> <?
> //file test.php
> phpinfo();
>
> $filename = "test.php"; //it does not work
>
> $filename =
> $_SERVER['DOCUMENT_ROOT']."/home/ke000067/public_html/test.php"; //it
> does not work
>
> $filename =
> $_SERVER['DOCUMENT_ROOT']."/~ke000067/public_html/test.php"; //it
> does not work
>
> $filename = "home/ke000067/public_html/test.php"; //it does not
> work
>
> echo 'fila buscada: '.$filename.'<br>';
>
> if (file_exists($filename)) {
> echo 'Of course it is.<br>';
> }else{
> echo 'What?? How can it be???.<br>';
> }
>
> ?>
>
>
> these are some values retieved from phpinfo
> _ENV["REMOTE_PORT"] 2010
> _ENV["SCRIPT_FILENAME"] /home/ke000067/public_html/test.php
> _ENV["SCRIPT_URI"] http://200.50.110.233/~ke000067/test.php
> _ENV["SCRIPT_URL"] /~ke000067/test.php
> _ENV["SERVER_ADDR"] 200.50.110.233
> _ENV["SERVER_NAME"] 200.50.110.233
> _ENV["SERVER_PORT"] 80
> _ENV["SERVER_SIGNATURE"] <ADDRESS>Apache/1.3.33 Server at
> 200.58.112.233 Port 80</ADDRESS>
> _ENV["SERVER_SOFTWARE"] Apache/1.3.33 (Unix) mod_auth_passthrough/1.8
> mod_bwlimited/1.4 mod_log_bytes/1.2 mod_ssl/2.8.22 OpenSSL/0.9.7e
> FrontPage/5.0.2.2635
> _ENV["GATEWAY_INTERFACE"] CGI/1.1
> _ENV["SERVER_PROTOCOL"] HTTP/1.1
> _ENV["REQUEST_METHOD"] GET
> _ENV["REQUEST_URI"] /~ke000067/test.php
> _ENV["SCRIPT_NAME"] /~ke000067/test.php
> _ENV["PATH_TRANSLATED"] /home/ke000067/public_html/test.php
>
>
> I'm really confused about paths. Now I think that it is not a good idea
> to learn on local server, beacause whenever one changes to a shared
> one, all seems to fail....
>
> Any hints?
>
> sdos - jm
>

Julian,

It should work if you either use relative addressing ("test.php") or
absolute addressing from the web server's root directory
($_SERVER['DOCUMENT_ROOT'] . "/test.php") assuming test.php is in the
root directory.

I develop a lot of scripts on my local machine and upload them with no
problems.

The fact you're having problems with such a basic function indicates to
me your hosting service has something set up incorrectly.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация