0

I've uncommented gd in php.ini - but I still can't get imagecreatefromjpg() to work... How does one enable php with jpg support? (the default php that comes with mac - not xampp or homebrew. trying to avoid multiple installations, low disk space etc)

Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpg()

ina
  • 841
  • Which version of macOS - php is not on Modern versions – mmmmmm Jan 16 '22 at 14:42
  • It's included with Big Sur and Catalina etc – ina Jan 17 '22 at 02:30
  • I think this is really fun: $ php --version WARNING: PHP is not recommended PHP is included in macOS for compatibility with legacy software. Future versions of macOS will not include PHP. PHP 7.3.29-to-be-removed-in-future-macOS (cli) (built: Sep 6 2021 05:14:39) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies – Marc Wilson Jan 17 '22 at 02:48
  • Well, that's the thing, lots of Mac legacy software will take time to upgrade so it'd be around for a while? Also, I prefer Big Sur and Catalina for so many compatibility reasons too – ina Jan 17 '22 at 03:25
  • Apple's gone to the trouble to have php emit that message of all the scripting languages that macOS includes, so I wouldn't count on it being there. – Marc Wilson Jan 17 '22 at 15:01
  • So I'm looking for a solution for right now, in Big Sur, where php is still included – ina Jan 18 '22 at 12:17

1 Answers1

1

I see you have asked not to use homebrew, but if you are doing web development on your Mac then you should really be using it. At a guess, the pre-installed PHP on Mac OS probably does not have the GD library installed.

If you install brew.sh you can then run brew install gd which will add the GD library which contains imagecreatefromjpg() and other image manipulation functions.