LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-29-2004, 10:25 AM   #1
imsam
Member
 
Registered: Dec 2003
Posts: 64

Rep: Reputation: 15
Question How do I check if PHP is installed?


Hi,

I need PHP w/ GD2Lib on my machine. How do I check if PHP is installed and running? How do I start it if it's installed but not running?

Also how do I check if GD2Lib is installed?
 
Old 11-29-2004, 10:38 AM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Put this in a file on your server:
Code:
<? phpinfo(); ?>
then browse to it. If you see code, PHP is either not installed or not enabled. If you see a PHP info page, it'll tell you all about what it was built with.
 
Old 11-29-2004, 01:27 PM   #3
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
that will only work if PHP is indded installed AND has been added to Apache...

you could try something as simple as
Code:
locate php
 
Old 11-29-2004, 01:39 PM   #4
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Assuming of course that you have shell access to the server.

And if you did, why not run a command that will give you something useful. The original poster doesn't mention their distro, but if it's rpm based, this'll do it:

rpm -qa | grep -i php

where locate php on a FC2 box that does NOT have php installed returns 85 entries (not counting /home/(.*)).
 
Old 11-29-2004, 02:49 PM   #5
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
Good point... I assumed there was shell access as he said "my machine"

Then again... depending on the distro... you should be able to check the package managment system to determine if it is installed or not as well...

imsam, tell us what distro you are using...
 
Old 11-29-2004, 03:02 PM   #6
imsam
Member
 
Registered: Dec 2003
Posts: 64

Original Poster
Rep: Reputation: 15
Thank you all...

Hi,

First, thank you all for your help and responses. I'm actually using Scientic Linux.

I do have shell access. When I used the rpm -qa | grep -i php command, I got the info I needed telling me that PHP is installed. I wanted to try locate php just for the heck of it but I got an error telling me that some kind of database is not installed. I can get the exact message if you guys need it.

Now, I'm not sure -- as I'm a newbie -- what it means to add PHP to Apache. I also don't know how to do it or check if it is already added. Also the GD2Lib for PHP. How do I check if that's installed?
 
Old 11-29-2004, 03:07 PM   #7
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
The GD2Lib i don't know... never heard of it...

by adding php to apache... (assuming you are using the apache webserver, if not please advise) This means to insert a small string into the apache "httpd.conf" file to load the PHP modules so it can recognize and interperet PHP files...

The string is different depending on the installed version of PHP though...
 
Old 11-29-2004, 03:50 PM   #8
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
The locate database being too small is because your cron job hasn't fired yet to make it update (It's a weekly on most systems).

GD2 is a graphics library yes? I don't know of a way to tell if that's in PHP or not short of the <? phpinfo(); ?> posted earlier.

To load the module, you need something like this in httpd.conf, assuming it's not there already:
Code:
(For 1.3.x)
LoadModule php4_module        modules/libphp4.so
AddModule mod_php4.c

(For 2.0.x)
LoadModule php4_module        modules/libphp4.so
I'm working from memory on 2.0.x -- That may not be exactly right

This should appear in your httpd.conf file (or .htaccess in the directory for your php files if nothing else)
Code:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType is handled by mod_mime which is the same for Apache 1.3.x, 2.0.x and 2.1.x
 
Old 02-13-2012, 02:51 PM   #9
lplough81
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
not sure how to carry out php test

Hi,
I have been following this thread (which seems to have been dead for some time)...But I too need to check if php is working. Im not quite sure how to add the phpinfo() script to my server. Is that apache?

Im new to Linux-- working on Ubuntu 11.10. Any help on testing php for someone with little experience on linux would be much appreciated

lP
 
  


Reply



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
check if selinux is installed linuxmandrake Debian 10 09-27-2005 05:05 PM
How to check SW installed not by rpm maxgg Linux - Newbie 1 12-23-2004 09:29 AM
How do I check what wm I have installed. mlsbraves *BSD 12 12-08-2004 10:25 PM
How to check that JDK Installed? sikandar Linux - Software 2 09-09-2003 12:44 AM
How to check for installed software... tarballed Linux - General 3 04-02-2003 04:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:25 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
Open Source Consulting | Domain Registration