I'm trying to get a php script to run on a private server ... problem is it won't work. I had been testing the script on a public server and it works fine there.
I ran a php info script to see the differences in the servers and got the following:
Good Server:
php 4.4.4
apache 1.3.7
Bad Server:
php 5.1.4
apache 2.2
Here's the script:
PHP Code:
<?
define('SERVER_ROOT','/home/XXXX/public_html/'); // Server path to domainname
define('WEB_PATH','rotate/birthdays/'); // Path to images under domainname
// In the above example, http://www.domain.com/ would use files
// located on the server in /home/httpd/html and the images to
// be called by this script are at http://www.domain.com/pics/staff
$files = array();
$d = dir(SERVER_ROOT . WEB_PATH);
while (($filename = $d->read()) !== false)
if (substr($filename,-4)=='.jpg')
$files[] = $filename;
$d->close();
if (count($files)<1) die ('No Images Found');
// Seed Random Number
list($usec,$sec) = explode(' ', microtime());
srand((float) $sec + ((float) $usec * 100000));
$imgnum = rand(1,count($files));
if (isset($files[0]))
$file2use = $files[$imgnum-1];
else
$file2use = $files[$imgnum];
// START GET DISPLAY NAME
// filename (no path) is in $file2use
$dispname = substr($file2use,0,-4); // Gets rid of the .jpg extension
$dispname = str_replace('_',' ',$dispname); // Converts underscores to spaces
$dispname = ucwords(strtolower($dispname)); // Make sure names are capitolized
// END GET DISPLAY NAME
// Displayed name is in $dispname
$imgpath = WEB_PATH . "/" . $file2use;
?>
When configuring the script for the public server ... I entered the wrong server root, but received an error. On the bad server, I receive no such error -- ever.
I was just wondering if anyone could tell me if this is some kind of compatibility issue or not -- and if so, what I could do about it.
Thanks.