Re: install error?..bug??
| From: | Howard Gillison | Date: | Thu, 17 Oct 2002 18:32:35 +0000 |
| Subject: | Re: install error?..bug?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120380@lists.php.net to get a copy of this message | ||
gads!!!!
okay.... :)
First of all, thank you. I now know "what" problem I am chasing. I tried
your clip of code, and it didn't work - BUT - I changed it a bit so that it
reads:
<?php
if
(file_exists("/complete/full/path/to/directory/name_of_this_file.php.")) {
echo "EXISTS"; }
else {
echo "DOES NOT EXIST";
}
?>
and that works. that would tell me that my application is losing "context"
of it's location (working directory) as it is running. the original code
says:
"./file.name"
and that file.name file is sitting in the SAME directory where the PHP
script is running. The full path to that file in the original script WORKS.
So, with that information, is there some nifty setting in the php.ini file
or soemthing that I can do so that Iplanet server doesn't lose the context
(or PHP doesn't lose the context) of hte working directory??
The application I am installing is running at many many sites, and a problem
like this surely is something local, and, I suspect something that is not
documented for me to check on
hints??
"Jason Wong" <php-general@gremlins.com.hk> wrote in message
news:<200210180156.09812.php-general@gremlins.com.hk>...
> On Thursday 17 October 2002 21:56, Howard wrote:
> > Good morning,
> >
> > I'm reasonably new to the world of PHP and have loaded PHP V4.2.3 onto a
> > Sun Solaris system running Solaris 8 with Iplanet (formerly Netscape)
> > Version 6.0 with Service Pack 4 installed.
> >
> > I'm not sure exactly what "error" I am seeing, but I do know that there
are
> > some rather obscure errors being encountered while I am installing a PHP
> > based package into our WebServer. I've no idea what is causing the
> > problem - I can *SEE* the problem, but I have no clue what to do or
where
> > to turn to fix/address the issue.
> >
> > here is the scoop:
> >
> > inside of an "install.php" script that is executed via the webserver, is
a
> > section of code that looks like this:
> >
> > $path="./this.that";
> >
> > if(file_exists($path)==0 {
>
> It's better (easier to understand) if you use:
>
> if (!file_exists($path)) {
>
> Also for debugging add:
>
> echo "file does not exist";
>
> > $styetext="";
> > } else {
> > $filesize=filesize($path);
> > $filenum=fopen($path,"r");
> > $styletext=fread($filenum,$filesize);
> > fclose($filenum);
> > }
> > if ($styletext=="") {
> > echo "<p> ensure that the this.that exists in teh current directory,
> > and then reload this current page. </p>;
> > exit;
> > }
>
> It's probably a bad idea to set $styletext in two places. What if
>
> $styletext=fread($filenum,$filesize);
>
> resulted in $styletext being empty? Then your error message would be
> misleading.
>
> > that's the code that is showing me that there is a problem. No matter
how
> > I set file protections or ownership, that file appears to never exist.
If,
> > however, I comment out this section of the code, the installation will
run
> > on to completion. That tells me that some of the calls like "if
> > (file_exists....)" aren't giving back valid results - or , they simply
> > aren't being executed as the install script expect (or it's a bug????).
>
> Try a simple 'one' liner test program:
>
> <?php
> if (file_exists('name_of_this_file.php.')) {
> echo "EXISTS"; }
> else {
> echo "DOES NOT EXIST";
> }
> ?>
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Everyone's in a high place when you're on your knees.
> */
>