php.ini variable preventing fopen() - filesize() - fclose() functions?

This is a openscript php code verification script that prevents auto entry where a human views alpha-numeric text and then types in what they see.

Works on different server, not the one copied to hence wondering if php.ini variables are the cause.

Url =

Code =


 *                            Dolphin Web Community Software
 *                              -------------------
 *     begin                : Mon Mar 23 2006
 *     copyright            : (C) 2006 BoonEx Group
 *     website              :

 *   This is a free software; you can modify it under the terms of BoonEx
 *   Product License Agreement published on BoonEx site at
 *   You may not however distribute it for free or/and a fee.
 *   This notice may not be removed from the source code. You may not also remove any other visible
 *   reference and links to BoonEx Group as provided in source code.

require_once( "" );

$chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J",
$textstr = '';
for ($i = 0, $length = 5; $i < $length; $i++) {
   $textstr .= $chars[rand(0, count($chars) - 1)];
$hashtext = md5($textstr);

$_SESSION['strSec'] = $hashtext;

if ( produceSecurityImage( $textstr, $hashtext ) != IMAGE_ERROR_SUCCESS )
      // output header
      header( "Content-Type: image/gif" );
      // output error image
      $errorFilename = $ID_PIC_DIR . 'simg_error.gif';
      $fp = fopen( $errorFilename, 'r' );
      $fsize = filesize( $errorFilename );
      if ( $fp )
            print fread( $fp, $fsize );
      fclose( $fp );


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Most likely... safe_mode is on, and that prevents you from using fopen on files that are outside your include directories....  either turn safe_mode off, or add whatever $ID_PIC_DIR point to to your include directory
Seems that function produceSecurityImage( $textstr, $hashtext ) returns an error

Can you post the content of
qdcsincAuthor Commented:
I need to install the gd_library.


Do you know how to install the gd library and change php.ini settings?
try uncommenting

extension=php_gd2.dll in your php.ini file

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.