0

After having spent a good few hours with this, I still can't get this to work. I'm using XAMPP with PHP 8.1.6. This is a Laravel 9 project and I'm trying to use GD library. Also, I'm using Laravel's built-in server (php artisan serve) and not Apache that comes with XAMPP. After having gone through many, many articles and posts, I have configured and verified the following:

  • phpinfo tells me that the server is using php.ini from c:\xampp\php\php.ini.
  • extension=gd line in php.ini is uncommented.
  • php_gd.dll is available in C:\xampp\php\ext folder.
  • GD appears to be installed in that I can see the following line in phpinfo output: enter image description here
  • I can also see gd listed in the output of php -m command. However, there is no detailed GD section in phpinfo output.
  • When I call a GD function (through Intervention library), it tells me that:

GD Library extension not available with this PHP installation.

  • Restarting php artisan serve or VSCode itself doesn't change anything.
  • Starting/stopping Apache through XAMPP Control Panel also doesn't have any effect (plus I can't see why this should be required since I'm not using Apache to serve my application, but this is mentioned in too many articles, so I gave it a try.)

Please suggest if you can see anything else that I could try.

Edit

The suggested post does not address my problem for two reasons. Firstly most answers there are about Linux (apt-get and sudo stuff) whereas I'm on Windows 11. The only relevant suggestion in that post is removing the semicolon from the extension entry in php.ini, which I have already done.

So far it looks like it really might be a limitation of PHP's built-in web server that it can't load GD (or any other) extension. I'd be thankful if someone could confirm it or provide a reference to whether this is or isn't the case.

dotNET
  • 33,414
  • 24
  • 162
  • 251
  • 1
    Does this answer your question? [Extension gd is missing from your system - laravel composer Update](https://stackoverflow.com/questions/39384644/extension-gd-is-missing-from-your-system-laravel-composer-update) – Wahyu Kristianto Mar 12 '23 at 16:45
  • @WahyuKristianto: Thanks. I have gone through that article. Most of the suggestions I have already tried as you can see above, except the `sudo apt-get install php7.4-gd` command, which is Linux-specific. I don't know if I need to run that on Windows 11 + XAMPP setup and if yes, what is the Win equivalent of it. I have read that gd comes with XAMPP and I don't need to download or install anything extra. Not sure if that's correct. – dotNET Mar 12 '23 at 16:52
  • Check the extension appears in the list when you run `php -m`. Alternatively, does `extension_loaded('gd')` return **true** when you run it in `php artisan tinker` ? – IGP Mar 12 '23 at 17:00
  • @IGP: `php -m` shows `gd` in the list (I have mentioned it in the post). `extension_loaded('gd')` returns `true`. – dotNET Mar 12 '23 at 17:02
  • Well, I'm all out of ideas. What version is Intervention? Perhaps there is some weird compatibility issues. – IGP Mar 12 '23 at 17:28
  • `"intervention/image": "^2.7",`. BTW, I've been digging it deeper into the framework code. The line `Image::make()` for some reason calls `AliasLoader` with `$alias` parameter set to `Intervention\Image\Facades\Image` (and not `Image` as it should be since I have added `'Image' => Intervention\Image\Facades\Image::class,` to my `config/app.php`. `AliasLoader` thereupon returns null since it can't locate that alias in its list of registered aliases. Weird stuff... :( – dotNET Mar 12 '23 at 18:54
  • Update: This doesn't seem to be related to aliasing. My understanding so far is that PHP's built-in web server does not support external extensions (or at least `GD`). But I'll post here if I find anything else. Any help is welcome. – dotNET Mar 12 '23 at 19:52
  • I think you should try using WSL2 + Laravel Sail, I know it is not the solution you would like to receive, but it is going to be easier and if you don't know much about Linux, you are going to learn a lot, helping you in your career 100% – matiaslauriti Mar 12 '23 at 20:00
  • @matiaslauriti: Yeah. That will be my last resort. For now I'm more interested in digging the bigger problem of whether this is a configuration/versioning issue on my end, or Laravel artisan development server really doesn't support any extensions. – dotNET Mar 12 '23 at 20:13

0 Answers0