LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-14-2013, 07:23 AM   #1
anondren
LQ Newbie
 
Registered: Jun 2013
Distribution: debian
Posts: 5

Rep: Reputation: Disabled
How to install php gd library on backtrack 5r3


I am new on linux and my question is how to install gd library in php on linux.I am frustrated please help me and I also tried a lot of reference site but still I faced the same problems.
 
Old 06-14-2013, 07:59 AM   #2
shm0
Member
 
Registered: Aug 2012
Location: Bahrain
Distribution: Slackware
Posts: 58

Rep: Reputation: 16
Quote:
Originally Posted by anondren View Post
I am new on linux and my question is how to install gd library in php on linux.I am frustrated please help me and I also tried a lot of reference site but still I faced the same problems.
Which Linux distro are you using? You might be able to easily download the gd library through the package manager.
 
Old 06-14-2013, 08:11 AM   #3
anondren
LQ Newbie
 
Registered: Jun 2013
Distribution: debian
Posts: 5

Original Poster
Rep: Reputation: Disabled
Backtrack 5r3 and it is Debian distribution.I also tried to install from package manager using apt-get install php5-gd command and It says Broken packages,So what to do?
 
Old 06-14-2013, 08:15 AM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,528

Rep: Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056
You don't install the GD library in PHP, you install it in the system and PHP then can use it; GD may already be on your system -- try
Code:
whereis libgd
libgd: /usr/lib64/libgd.so /usr/lib64/libgd.la
If you see something similar to this, it's already there; if not, read on...

You would use yum, apt-get, yast or whatever your system has for add-on software or you can download, build and install from source; see http://libgd.bitbucket.org/.

Also, see http://php.net/manual/en/book.image.php for how to configure PHP to use it (you may -- may! -- need to recompile PHP but probably not). GD may already be enabled in your installed version -- look in your php.ini file (it should be somewhere in the /etc directory -- on my systems it's found in /etc/httpd, yours may vary). You're looking for
Code:
grep gd /etc/httpd/php.ini
extension=gd.so
;extension=php_gd2.dll
[gd]
; a gd image. The warning will then be displayed as notices
; http://php.net/gd.jpeg-ignore-warning
;gd.jpeg_ignore_warning = 0
The one you're looking for is boldface above.

And do look through the manual page linked above.

Hope this helps some.
 
1 members found this post helpful.
Old 06-14-2013, 09:02 AM   #5
anondren
LQ Newbie
 
Registered: Jun 2013
Distribution: debian
Posts: 5

Original Poster
Rep: Reputation: Disabled
whereis libgd

I tried above command on terminal and found following output:

libgd: /usr/local/lib/libgd.a /usr/local/lib/libgd.so /usr/local/lib/libgd.la

and I placed

grep gd /etc/httpd/php.ini
extension=gd.so
;extension=php_gd2.dll
[gd]
; a gd image. The warning will then be displayed as notices
; http://php.net/gd.jpeg-ignore-warning
;gd.jpeg_ignore_warning = 0

On php.ini file which above you have posted and restart the apache2 and still faced that kind of error and I also tried phpinfo() there is no any gd library

Last edited by anondren; 06-14-2013 at 09:09 AM.
 
Old 06-14-2013, 10:07 AM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,528

Rep: Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056
OK, you've got the GD library installed. But, your PHP installation may not have been compiled with GD enabled.

If you run (in a terminal window)
Code:
php phpinfo.php | more
You should see, at the top, something similar to this:
Quote:
phpinfo()
PHP Version => 5.4.16

System => Linux fubar 3.2.45 #2 SMP Tue May 21 23:43:44 CDT 2013 x86_64
Build Date => Jun 8 2013 18:05:34
Configure Command => './configure' '--prefix=/usr' '--libdir=/usr/lib64' '--with-libdir=lib64' '--localstatedir=/var' '--sysconfdir=/etc' '--datarootdir=/usr/share' '--datadir=/usr/share' '--infodir=/usr/info' '--mandir=/usr/man' '--with-apxs2=/usr/bin/apxs' '--enable-fpm' '--with-fpm-user=apache' '--with-fpm-group=apache' '--enable-maintainer-zts' '--enable-pcntl' '--enable-mbregex' '--enable-tokenizer=shared' '--with-config-file-scan-dir=/etc/php' '--with-config-file-path=/etc/httpd' '--enable-mod_charset' '--with-layout=PHP' '--disable-sigchild' '--enable-xml' '--with-libxml-dir=/usr' '--enable-simplexml' '--enable-xmlreader=shared' '--enable-dom=shared' '--enable-filter' '--disable-debug' '--with-openssl=shared' '--with-pcre-regex=/usr' '--with-zlib=shared,/usr' '--enable-bcmath=shared' '--with-bz2=shared,/usr' '--enable-calendar=shared' '--enable-ctype=shared' '--with-curl=shared' '--with-curlwrappers' '--with-mcrypt=/usr' '--enable-dba=shared' '--with-gdbm=/usr' '--with-db4=/usr' '--enable-exif=shared' '--enable-ftp=shared' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-xpm-dir=/usr' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--enable-gd-native-ttf' '--with-gettext=shared,/usr' '--with-gmp=shared,/usr' '--with-iconv=shared' '--with-imap-ssl=/usr' '--with-imap=/usr/local/lib64/c-client' '--with-ldap=shared' '--enable-mbstring=shared' '--enable-hash' '--with-mysql=shared,mysqlnd' '--with-mysqli=shared,mysqlnd' '--with-mysql-sock=/var/run/mysql/mysql.sock' '--enable-pdo=shared' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-sqlite=shared,/usr' '--with-pspell=shared,/usr' '--with-enchant=shared,/usr' '--enable-shmop=shared' '--with-snmp=shared,/usr' '--enable-soap=shared' '--enable-sockets' '--with-sqlite3=shared' '--with-regex=php' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx=shared' '--with-xsl=shared,/usr' '--enable-zip=shared' '--with-tsrm-pthreads' '--enable-intl=shared' '--enable-shared=yes' '--enable-static=no' '--with-gnu-ld' '--with-pic' '--build=x86_64-slackware-linux'
That tells you how PHP was configured when it was compiled -- the highlighted configuration options must be there for GD to be enabled.

And, further down, you should see
Code:
gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype                                                                  
FreeType Version => 2.4.11
T1Lib Support => enabled
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 8
PNG Support => enabled
libPNG Version => 1.4.12
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
If you don't see those, PHP was not built to support GD or it was built with support but it is not enabled. If it's built but not enabled, you can enable it in php.ini. On the other hand, if it was not built to support GD, you will have to build it from source and update your existing PHP installation -- this is not a trivial undertaking.

Now, if those do exist then, yes, GD is there and enabled (if I understand what you're saying).

In that case, I would suggest that you perhaps haven't coded whatever it is you're trying to display with GD correctly and I'll point you to the link in the earlier post to the PHP manual page describing its use (and includes examples).

Hope this helps some.

Last edited by tronayne; 06-14-2013 at 10:08 AM.
 
1 members found this post helpful.
Old 06-14-2013, 12:06 PM   #7
anondren
LQ Newbie
 
Registered: Jun 2013
Distribution: debian
Posts: 5

Original Poster
Rep: Reputation: Disabled
When I run this code php phpinfo.php | more on terminal I found following message

root@bt:~# php phpinfo.php | more
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
Could not open input file: phpinfo.php
 
Old 06-14-2013, 12:37 PM   #8
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,528

Rep: Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056
So make one:
Code:
<?php
phpinfo();
?>
 
1 members found this post helpful.
Old 06-14-2013, 08:03 PM   #9
anondren
LQ Newbie
 
Registered: Jun 2013
Distribution: debian
Posts: 5

Original Poster
Rep: Reputation: Disabled
Sir, I download php-5.4.16 version of php and installed it, after that I run phpinfo(); using php /var/www/phpinfo.php | more and as well as from localhost/phpinfo.php, there is no any word gd, in other word there is no function like this

Quote:
gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.4.11
T1Lib Support => enabled
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 8
PNG Support => enabled
libPNG Version => 1.4.12
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
 
Old 06-15-2013, 07:20 AM   #10
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,528

Rep: Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056Reputation: 1056
Your profile indicates that you're using Debian?

I searched from "debian php enable dg" with Google. That turned up this link that you may want to take a look at: http://packages.debian.org/squeeze/php5-gd; it's for Squeeze, but there are other, similar, links for php5-gd (5.3.3-7+debian_version) that appear in the list from Google.

It looks like Debian does with-gd and without-gd separate PHP packages.

So, I suggest you use Google and take a look at each of the results for your "flavor" of Debian, download and install the appropriate package and you'll most likely be good to go.

Hope this helps some.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deep freeze in backtrack 5r3 can_cworld Linux - Laptop and Netbook 5 05-28-2013 09:15 AM
How to set up routing on BackTrack 5r3? aburmot Linux - Networking 1 04-17-2013 05:57 AM
[SOLVED] backtrack 5r3 in thosiba c640d won't install can_cworld Linux - Laptop and Netbook 2 02-15-2013 05:56 PM


All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration