php path to gd library - php

I am trying to use Codeigniter's image manipulation class which of course requires a php image library.
I know I have gd library enabled on my server from running phpinfo();
However, I need to specify the path to the image library in codeigniter, and I don't know where it is installed! The server is under someone else's jurisdiction, so is there any way at all to find out where the gd library is installed without using the command line? It is a linux server.
Thanks.

GD is compiled with PHP, and is used internally, there is no need to supply a path for GD what so ever, on CI's Manual it states:
library_path : Sets the server path to your ImageMagick or NetPBM library. If you use either of those libraries you must supply the path.
Hint: you are not using ImageMagick or NetPBM
If you mean ImageMagick, you can locate the binaries you can try the following command:
locate imagemagick
but they are usually located in /usr/bin or /usr/X11R6/bin/

did you try phpinfo();
you will get the path to where php installed.
if you can access server
try to search for gd.so
http://www.linuxquestions.org/questions/linux-newbie-8/gd-library-path-145032/
http://php.net/manual/en/image.installation.php

Related

How to configure imagick / ImageMagick on ipage?

Ipage says they are running ImageMagick 6.3.3 however, it is not running on the server and there is no way I can find how to enable it. They do not allow to configure any module from control panel.
I contacted support but they could not help saying, it is not 'their' product. Anybody can help setting up Imagick on ipage? I tried to edit php.ini file and reference to php_imagick.dll but that did not solve the problem.
iPage does not support Imagick in PHP
This is their official response after conctacting support
We have ImageMagick binaries. But it is not complied to PHP so IMAGICK
won't work. So, you will not be able to use IMAGICK as PHP built-in
class. You have to use the alternative "convert" utility. Please make
changes accordingly in the script so that it will work fine on our
servers.
So basically you have to use exec() in PHP to use the Imagemagick convert command. Also you cannot use convert command from a shell environment as for as I know.
But there is GD commands available on ipage and for the most part they would be enough for all graphic related functions. In fact in my case, I found that they were rather moreful.
The answer I got from iPage is that PHP Imagick is not available on the Essential Package. To get PHP Imagick I would need to sign up for VPS hosting which is more expensive. For now I am giong to ignore the recommendation from Wordpress to install PHP Imagick. I have installed the Wordpress "ImageMagick Engine" plugin and it is now working with no errors.

Are PHP extensions just "shell cases" for real libraries?

If this is true and PHP extensions run shell commands in the background, why not just use shell_exec instead? Would there be any difference? I'm under the impression that PHP extension are usually written by newbs because they are full of bugs. For example the imagick extension :/ So why not communicate with the library directly?
No, absolutely not. Most PHP extensions interface directly with a C library, and imagick is no exception.
The shoddiness of the imagick extension is entirely the fault of the ImageMagick library itself.

Point imagick to location other than /usr/bin

I'm trying to compile the imagick extension for Heroku, but I need it to look in the /app/bin folder for ImageMagick rather than the /usr/bin/ folder. I've used as much google-fu as I have, but I can't figure out how to build the imagick.so extension and have it point to a different folder.
From PHP, if I do shell_exec("which convert") it echoes the /app/bin version, but when I do Imagick::getVersion() it points to the /usr/bin/ version. This makes me think it's an issue in the extension.
I haven't ever had to make my own extension from source, so that could definitely be part of the reason. Anything you could do to point me in the right direction would be helpful.
Try with a php.ini file in the webroot, with the following contents:
extension_dir="/app/bin"
extension=imagick.so
You may have the wrong end of the stick. You don't compile the Imagick extension against the Image Magick executables but against the Image Magick libraries. i.e. if you're installing Image Magick through a package manager, you should be installing "ImageMagick-devel" not "ImageMagick"
You can then set the directory that Imagick should look for the Image Magick libraries for with the setting:
./configure --libdir=/usr/lib64 --with-php-config=/usr/local/bin/php-config
Or similar depending on where the libraries are installed, and then call make.
However if you're already compiling Imagick you might as well as also compile Image Magick from source.
Edit
If I was standing behind you, this would probably be solvable in 5 minutes. I suggest:
1) Find where the Imagick libraries actually are on your system - in particular find the libMagickWand-6.Q16.so file.
2) Make sure you're copying the Image Magick libraries that you want to use to the live server as well as the Imagick library, unless you're statically compiling it (which you probably aren't).
3) Rename the lib that you don't want it to be compiled against. See if compiling Imagick picks the right version up then.
4) Debug the ./configure script for Imagick - you can print stuff out like AC_MSG_RESULT(libs before $DEBUG_LIBS) as I had to do for one issue: https://github.com/mkoppanen/imagick/issues/8 and ensure it's picking the right version up when compiling.
5) Raise an issue at https://github.com/mkoppanen/imagick/ and get the Imagick guy to have a look.

check for ghostscript support in php imagick?

is it possible to check the php imagick extension for ghostscript support?
for example if it is turned on / off, the ghostscript version used, etc.
which possibilities are there to get additional ghostscript / pdf details?
the only thing i've found so far is this (version of imagick lib itself):
http://php.net/manual/en/imagick.getversion.php
ps: no system calls are allowed (e.g. exec) from within php
I don't know much about imagick, but some things about imagemagick. My guess is that by reading this answer related to imagemagick could help you with imagick as well:
convert -list delegate | grep -Ei '(PDF|PS|EPS)'
(convert is one of the CLI utilities which are part of imagemagick.)

Getting Older PHP Extensions

It happens that I need the GD, SQLite and a few more extensions for php 5.1. But I can't find out where to get them.
I am using WinBinder to develop some desktop applications for Windows with php. The minimal php 5.1 pack has the winbinder extension only. I need other extensions for enhanced features like image editing or data storage.
Can anybody help? I really need this very much.
PS: I want to get pre-compiled DLLs if posible.
Thanks and Regards,
Masnun
Check here for your specific version: http://www.php.net/releases/
The 'Windows Binary' link will provide a .zip file containing the ext folder where you will find all standard extensions including php_gd2.dll and the 'Collection of PECL modules...' link will allow you to source additional extensions you may require.
You will still need to enable these in your php.ini as described in other comments.
Hope this helps,
Jason.
GD Installation
To enable GD-support configure PHP --with-gd[=DIR], where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option --with-gd. GD library requires libpng and libjpeg to compile.
In Windows, you'll include the GD2 DLL php_gd2.dll as an extension in php.ini. The GD1 DLL php_gd.dll was removed in PHP 4.3.2. Also note that the preferred truecolor image functions, such as imagecreatetruecolor(), require GD2.
Enhance the capabilities of GD to handle more image formats by specifying the --with-XXXX configure switch to your PHP configure line.
http://www.php.net/manual/en/image.installation.php

Categories