Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

PHP-GD enable support for PNG

Title says it all, how can one enable support for PNG? I don't want to use brew I don't want recompile whole PHP because of this mistake by Apple.

MacBook Pro (Retina, 15-inch, Mid 2014), OS X Yosemite (10.10)

Posted on Oct 21, 2014 1:47 PM

Reply
Question marked as Best reply

Posted on Oct 21, 2014 2:03 PM

Relying on apple to maintain your apache, php, and mysql installation is just plain silly. It only gets updated with major OS releases....


You are obviously a developer, part of being a developer is knowing how to maintain, and update your development environment....if you want php extensions that are not included with base OSX, the only way to get them is to download, compile and enable them in your php.ini.


Homebrew is ridiculously easy to use, and once setup it automatically will update your MAMP forever...


time to put on your grownup pants and learn the terminal....


FYI


I use macports, but homebrew is honestly even easier.

24 replies
Question marked as Best reply

Oct 21, 2014 2:03 PM in response to Kyslík

Relying on apple to maintain your apache, php, and mysql installation is just plain silly. It only gets updated with major OS releases....


You are obviously a developer, part of being a developer is knowing how to maintain, and update your development environment....if you want php extensions that are not included with base OSX, the only way to get them is to download, compile and enable them in your php.ini.


Homebrew is ridiculously easy to use, and once setup it automatically will update your MAMP forever...


time to put on your grownup pants and learn the terminal....


FYI


I use macports, but homebrew is honestly even easier.

Oct 21, 2014 2:10 PM in response to Mr. Studz

I have no problem with terminal, why did they enable php-gd and disable PNG only, are they serious? I recompiled once because of mcrypt was missing now I have to go thru that process one more time... And thing about using apples out of box php is because I don't need updates for my AMP stack ever. Everything I need works in php 5.3+

User uploaded file

Oct 21, 2014 2:50 PM in response to Kyslík

OK well here are your options:


Hope apple will provide a "fix" to the gd extension less than one percent of their user base is making use of....to their few day old bug ridden operating system......and even if they do deem this high enough priority to issue a patch...... you are looking at 2 weeks- month before it gets tested and released along with all the other bug fixes.


OR

install macports,

update your bash profile,

type sudo port port install php56 +apache2 php56-gd (and any other extensions you may like)

restart your web server: apachectl restart

and be done.


Literally we are talking 5 minutes, no 3 minutes to solve this problem on your own, plus have the added benefit of being able to install any other extension you may ever need, and automatically keep updated to the latest version of everything (php, mysql, apache) by simply typing :


sudo port upgrade outdated


With homebrew... its even easier......Google is your friend, my friend.

Feb 13, 2015 8:24 AM in response to Kyslík

Suggesting the user is ignorant isn't a way to help solve a problem. Be more helpful next time. I am dealing with this too and frankly, I don't want to install some bloatware like homebrew or macports when I know perfectly well how to install and maintain my own binaries without all the unnecessary crap those package managers install. Plus their implementation of MySQL is flaky and prone to crash without warning - so stop with the elitist "Let me google that for you" stuff and be useful.


You don't actually need to recompile PHP in OS X for anything with the exception of gd unfortunaely. I added mcrypt, pnctl, autoconf, librtool, intl, AND gd without the need for bloatbrew. The problem is GD is compiled into the PHP binary and cannot be overridden by a shared extension.


You can re-compile by pulling up a phpinfo() on your server and copying the compile string. Remove the lines about GD and recompile and it *should* replace your php binaries with the relevant ones you are compiling. There are some dependency issues you have to deal with, but if you're comfortable with the command line (which it sounds like you are) then you can resolve them by looking up the relevant libraries and install. To me, the time invested in manually installing only what you need is 1000% better than installing a bunch of crap that will live on your system that you don't need and may never use again as well as having to re-configure paths and what not.


I'm going to be posting a blog entry about how to do this because I know it will help someone. I just get really bent when someone implies they have to have someone put on their 'big boy pants' or 'google that' as an answer. You are not helpful.

Feb 24, 2015 12:42 PM in response to MBagnall

You are absolutely right. Install a foreign program. Do not even want to think that there is something extra on your server.

All over the internet only these methods and offers. To me, they are not suitable.

Im use Server.app 4

Please describe in detail, step by step what to do to GD function correctly.

You are the only hope.


Sorry for my english, google translator.

Feb 26, 2015 8:40 AM in response to Lyaer

I will be posting more documentation to this, but here is a solution you can use that handles most of the heavy lifting:


https://github.com/ElusiveMind/osx_server_enhancements


When you download this run the php-enhancer.sh script from terminal using sudo i.e:


sudo ./php-enhancer.sh


Once it is done running, re-start your web server. One thing of note, is you will need to install MySQL since that does not come with either OS X Server or standard OS X. So be sure to visit MySQL.org for information on setting that up on your mac.

Feb 26, 2015 11:52 AM in response to MBagnall

Thank you for not ignored my problem.

But I did not get. Php-enhancer.sh downloaded and packages. The terminal introduce:


sudo /Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 3: cd: packages: No such file or directory

tar: Error opening archive: Failed to open 'autoconf-2.69.tar.gz'

tar: Error opening archive: Failed to open 'freetype-2.5.5.tar.gz'

tar: Error opening archive: Failed to open 'jpegsrc.v6b.tar.gz'

tar: Error opening archive: Failed to open 'libgd-GD_2_0_33.tar.gz'

tar: Error opening archive: Failed to open 'libmcrypt-2.5.8.tar.gz'

tar: Error opening archive: Failed to open 'libpng-1.6.16.tar.gz'

tar: Error opening archive: Failed to open 'php-5.5.14.tar.gz'

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 12: cd: php-5.5.14: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 13: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 17: cd: ../autoconf-2.69: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 18: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 22: cd: ../freetype-2.5.5: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 23: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 27: cd: ../jpeg-6b: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 28: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 32: cd: ../libgd-GD_2_0_33: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 33: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 37: cd: ../libmcrypt-2.5.8: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 38: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 42: cd: ../libpng-1.6.16: No such file or directory

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 43: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 47: cd: ../php-5.5.14/ext/gd: No such file or directory

Cannot find config.m4.

Make sure that you run '/usr/bin/phpize' in the top level source directory of the module


/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 49: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 53: cd: ../mcrypt: No such file or directory

Cannot find config.m4.

Make sure that you run '/usr/bin/phpize' in the top level source directory of the module


/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 55: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 59: cd: ../pcntl: No such file or directory

Cannot find config.m4.

Make sure that you run '/usr/bin/phpize' in the top level source directory of the module


/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 61: ./configure: No such file or directory

make: *** No targets specified and no makefile found. Stop.

make: *** No rule to make target `install'. Stop.


Xcode Comand Line installed.

What am I doing wrong?

Please help :(

Feb 26, 2015 12:10 PM in response to Lyaer

sudo /Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh

/Users/WEBSPACE/Downloads/osx_server_enhancements-php-5-5-14/php-enhancer.sh: line 3: cd: packages: No such file or directory

tar: Error opening archive: Failed to open 'autoconf-2.69.tar.gz'

...



The script starts by unpacking a collection of downloads inside a packages directory - you do not have the downloads or the packages directory!

The script fails.


Looks like you need to go & get the sources for each of those packages that are 'Failed to open'.

PHP-GD enable support for PNG

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.