Jump to content

Browzer

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Everything posted by Browzer

  1. Using Apache 2.2.4 and PHP 5.2.1 on Windows, I was getting the "Call to undefined function imagecreate()" error. I solved the problem, but the solution for my situation was not documented anywhere on the web, so I am posting it here. The root of the problem is that the GD2 library is not installed. The first thing to do is make sure the GD2 library. Your php.ini file should have these lines extension_dir = "C:\PHP\ext" extension=php_gd2.dll It seems like this solves 99% of the cases...but not mine! The real problem was that PHP improprely edited Apache's httpd.conf file during installation. MAKE SURE the httpd.conf file has a clean reference to PHP that looks something like: # For PHP 5: LoadModule php5_module "c:/php/php5apache2.dll" AddType application/x-httpd-php .php # configure the path to php.ini PHPIniDir "C:/php/" In my case, all that text was on a single line with some odd characters (improper newlines?) in there. I think this was caused by a problem in the installation. Once I cleaned it up to look like the lines above, it worked. Anyway, hopefully this will save people some time.
  2. Hello, first poster here. I have to read bytes from a binary file. Often, I'm only reading 1 or 2 bytes at a time. The problem is that what I'm reading is being displayed as garbage. For example: $fh = fopen($filepath, 'rb') or exit("Can't open file"); $byte = fread($fh, 2) or exit("Can't read file"); printf("Byte = %u", $byte); The output is "Version = 0" (if I treat $byte as a string, the output is "Bytes = ?"). That is not correct. Here is the equivelant Java code reading from the same file: File f = new File(filepath); FileInputStream fis = new FileInputStream(f); DataInputStream dis = new DataInputStream(fis); short version = dis.readShort(); System.out.println("Version = " + version); The output is "Version = 2", which is correct. Any ideas? Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.