Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-01-2007, 03:37 AM   #1 (permalink)
msaz87
Junior Member
 
Join Date: Oct 2006
Posts: 11
Default Script compatibility issue

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.
msaz87 is offline   Reply With Quote
Sponsored Links
Old 02-15-2007, 03:59 PM   #2 (permalink)
Jose Garcia
Junior Member
 
Join Date: Feb 2007
Posts: 7
Default Re: Script compatibility issue

Hi,

Try adding this at the top:

error_reporting( E_ERROR | E_WARNING | E_PARSE );

That will print out any errors it might be getting sometimes servers are configured so that the errors don't print out.
Jose Garcia is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 03:35 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums