Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Updating gd / libpng for PHP
I followed the directions for LAMP installation. The code I’m using requires the GD module for PHP, which I installed. The code works as expected on my XAMPP localhost, but not on the live droplet. After a little digging around, my drop is running PHP 7.0.22, with GD Headers/Library version 2.1.1 and libPNG version 1.2.54. My local XAMPP is running PHP 5.6.28 with GD Version “bundled 2.1.0 compatable” with libPNG version 1.5.26. I’m assuming the version difference is the problem, as the same code works as intended on another webhost. I’d like to keep everything together, though,
I have two questions – before I installed the GD module, the code just wouldn’t create the file at all, so I thought perhaps I had folder permissions set wrong so that it couldn’t ‘write’ the file to the directory. What should folder permissions be set to so PHP can open a .png, crop it, then save it to a subfolder? I don’t know if setting those wrong opens up a door for something nefarious. This is a very low-traffic, one-day event, but I wanna do it right still.
Secondly, I think I need to update PHP’s libPNG module, and this is where I’m totally lost. I haven’t worked with Linux before, nor had to manually install PHP etc. – I was setting up an RTMP server for a Twitch marathon next month and it took me 20 minutes to find the /usr folder 'cause I thought the root folder was the “/” folder. So I’m not quite sure how to fix the issue. I think I need to update PHP’s libPNG libraries, and if I saw the command lines I have to put in I could understand them, but I don’t know what to download or what to go sudo apt-get.
I found a home page for libPNG but even if I found a download there, I wouldn’t know what to do with it. I don’t want to install libPNG to the server, I want to install it in a place where PHP will use it.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×