I've been working on a PHP script for a couple of months now, and normally I find answers to my questions in places like this. However, I seem to have come up with an original problem now.

I found some script to use to create a thumbnail, and it includes the function imagecreatefromjpeg(). When I run the script, however, I get the error

Fatal error: Call to undefined function: imagecreatefromjpeg()

I'm running Apache, with PHP version 4.2.0, and Windows XP. I went to the snapshot site and made sure that everything in my PHP folder was up to date, and I tried to un-comment the line in php.ini that says "extension=php_gd2.dll", but when I do that, Apache can't find the extension. It does exist in the Extensions folder.

I tried changing the extension line to "/extension=php_gd2.dll", and Apache seems to accept that, but I still get the error.

Any ideas?

    Try to run this...

    <?php
    if( !extension_loaded( 'gd' ) )
    {
    	echo 'GD isnt loaded.<br>';
    	if( !dl( 'gd.so' ) )
    		echo 'Couldnt load GD.<br>';
    	else
    		echo 'Successfully loaded GD.<br>';
    }
    else
    	echo 'GD is currently loaded.<br>';
    ?>
    

      It gave me this

      GD isnt loaded.

      Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension statements in your php.ini in C:\Program Files\Apache Group\Apache2\htdocs\btg\testgd.php on line 5
      Couldnt load GD.

      That's with the extension active and with a slash in front of it. Do I need to do something else to activate it?

        Apache2 sucks, use Apache 1.3.27; it rawks!

          Is Apache2 broken or something? Is it possible to downgrade it, or would I have to completely uninstall it, and would I lose any functionality that is new to Apache2?

            I have no need for Apache2, can't really see what you need in Apache2, that Apache1 doesn't have.

            Well, completely uninstall 2, then install 1.3.27.

            Good luck.

              Okay, I've done that, and my server is up and running. It does not appear to be recognizing php now, it tries to open another program when I go to the phpinfo page.

              I didn't have to set up anything to get php working with Apache2, is there something that needs to be done with this version? I've checked around, and I don't see anything.

                9 days later

                Hi Guys

                I'm siiting with the exact same problem as TangLiSha, only diffs is that I'm running Apache 1.3.24.
                I am getting the same error:

                GD isnt loaded.

                Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension statements in your php.ini in c:\www\testing php\test_gd.php on line 5
                Couldnt load GD.

                I am pretty new to php and not sure exactly how GD works, but I think we are missing it, or it is not installed.

                How can I install it?😕

                  9 months later

                  So check this out. I ran that nifty little diagnostice script that was helpfully posted and before it was evaluating to false like the rest of you. checked out the phpinfo(); page and noticed that it was never configured --with-gd so i go grab the latest php 4.3.4 and config with gd this time. rebuilt, restart apache, everything's cool (php5 crashed me btw). now that script evals to true but i STILL get "Call to undefined function: imagecreatefromjpeg"

                  now how in the world can that be? any ideas out there?

                  thanks,
                  -Ian

                    Write a Reply...