|  | Posted by igorp on 04/09/07 08:03 
On Apr 9, 1:30 am, Tyno Gendo <u...@example.com> wrote:> igorp wrote:
 > > Hi,
 > > can anyone tell me what's wrong with the following code:
 > > ==================================================
 > > <?php
 > >  echo "Hello this is a test file on my server Seen: ${_POST['seen']} </
 > > br>";
 >
 > >  if(!isset($_POST['seen']) )
 > > {
 > >  echo "HERE..."; $_POST['seen'] = 'yes';
 > >  require $_SERVER['SCRIPT_FILENAME'];
 > > }
 > > else{
 > >       echo "Not here...";
 > > }echo "At the end of script ";
 >
 > > ?>
 > > ==================================================
 > > Basically, the idea was that the script should  include/require
 > > itself
 > > at some condition, at the end of the script.
 > > While it works fine on my home server and prints out
 >
 > > Hello this is a test file on my server Seen:
 > > HERE...Hello this is a test file on my server Seen: yes
 > > Not here...At the end of script At the end of script
 >
 > > on my hosting provider server it does not work as expected, i.e. the
 > > include does not happen. The output will be:
 >
 > > Hello this is a test file on my server Seen:
 > > HERE...
 >
 > > Any help would be greatly appreciated,
 > > Igor.
 >
 > Try print_r($_SERVER["SCRIPT_FILENAME"]); and make sure you are getting
 > a file path as expected on the remote host and $_SERVER is working ok,
 > might be an old version of PHP on the hosting server.
 >
 > You could also try PHP_SELF var as the script is calling itself so you
 > shouldn't need to worry about a path.
 >
 > include($_SERVER["PHP_SELF"]);
 > or
 > include("./" . $_SERVER["PHP_SELF"]);
 >
 > if its a really old PHP on the hosting server it might use registered
 > globals... eg. $PHP_SELF ?
 
 
 Hi,
 here is an update -
 I've found that the problem is connected to the version of the PHP
 used running this script. If the script runs under PHP 4.4.6 at my
 hos provider server - it does just fine (it also works well at my
 desktop -
 Windows w. PHP 5.2.0 ) but with v.  5.2.1 it fails and causes a coe
 dump ....
 and causes php5.bin to create a core file.
 
 Igor
  Navigation: [Reply to this message] |