LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I check if PHP is installed? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-check-if-php-is-installed-260522/)

imsam 11-29-2004 10:25 AM

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?

sigsegv 11-29-2004 10:38 AM

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.

halo14 11-29-2004 01:27 PM

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

sigsegv 11-29-2004 01:39 PM

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/(.*)).

halo14 11-29-2004 02:49 PM

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...

imsam 11-29-2004 03:02 PM

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?

halo14 11-29-2004 03:07 PM

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...

sigsegv 11-29-2004 03:50 PM

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

lplough81 02-13-2012 02:51 PM

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


All times are GMT -5. The time now is 02:24 AM.