LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-04-2007, 06:19 PM   #1
LinuxCrazy
Member
 
Registered: May 2007
Posts: 48

Rep: Reputation: 15
Question php not running on apache 1


I have centos 4.1, apache Version 1.3

This is the error I get when I do php version. Is there anyone that know what could be wrong?

[root@localhost htdocs]# php version
Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.9

No input file specified.


php is installed, reinstalling php gave me this
[root@localhost ~]# rpm -Uvh php-4.3.9-3.22.5.i386.rpm
warning: php-4.3.9-3.22.5.i386.rpm: V3 DSA signature: NOKEY, key ID 9b3c94f4
Preparing... ########################################### [100%]
package php-4.3.9-3.22.5 is already installed
file /usr/bin/php from install of php-4.3.9-3.22.5 conflicts with file from package php-4.3.9-3.22.5
file /usr/lib/httpd/modules/libphp4.so from install of php-4.3.9-3.22.5 conflicts with file from package php-4.3.9-3.22.5
 
Old 06-04-2007, 06:33 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
You're missing a minus sign:
Code:
php -version
I get the following:
Code:
~$ php version
Could not open input file: version
~$ php -version
PHP 5.2.2 (cli) (built: May  6 2007 05:43:00)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Last edited by gilead; 06-04-2007 at 06:34 PM.
 
Old 06-05-2007, 10:45 AM   #3
LinuxCrazy
Member
 
Registered: May 2007
Posts: 48

Original Poster
Rep: Reputation: 15
This is what I got


[root@localhost ~]# php --version
PHP 4.3.9 (cgi) (built: May 10 2007 05:19:09)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies


but why is php not running in my browser?
 
Old 06-05-2007, 01:59 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Do you have any php entries in your web server config? For example, I have the following for PHP 5 in my Apache 2.0.x httpd.conf file (the lines aren't together, I just grepped for php):
Code:
LoadModule php5_module        modules/libphp5.so
DirectoryIndex index.html index.html.var index.php
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
 
Old 06-05-2007, 03:18 PM   #5
LinuxCrazy
Member
 
Registered: May 2007
Posts: 48

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by gilead
Do you have any php entries in your web server config? For example, I have the following for PHP 5 in my Apache 2.0.x httpd.conf file (the lines aren't together, I just grepped for php):
Code:
LoadModule php5_module        modules/libphp5.so
DirectoryIndex index.html index.html.var index.php
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
no, I don't have any of that. Is that needed?
 
Old 06-05-2007, 06:48 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Yes it is - otherwise Apache won't recognise the .php files. I don't know if your first post indicates a problem with the rpm install but there should be a docs directory installed as well. In there, have a look for the INSTALL file. The following is from the instructions for installing PHP 5 under Apache 2.0:
Code:
14. Edit your httpd.conf to load the PHP module.  The path on the right hand
    side of the LoadModule statement must point to the path of the PHP
    module on your system.  The make install from above may have already
    added this for you, but be sure to check.

    For PHP 4:

      LoadModule php4_module modules/libphp4.so

    For PHP 5:

      LoadModule php5_module modules/libphp5.so

15. Tell Apache to parse certain extensions as PHP.  For example,
    let's have Apache parse the .php extension as PHP.  You could
    have any extension(s) parse as PHP by simply adding more, with
    each separated by a space.  We'll add .phtml to demonstrate.

      AddType application/x-httpd-php .php .phtml

    It's also common to setup the .phps extension to show highlighted PHP
    source, this can be done with:

      AddType application/x-httpd-php-source .phps
I compiled mine from source and the make install put the module into the correct Apache directory for me. I'm assuming the rpm install you ran did the same.
 
Old 06-06-2007, 11:00 AM   #7
LinuxCrazy
Member
 
Registered: May 2007
Posts: 48

Original Poster
Rep: Reputation: 15
I did add this below. but now everytime I go to a php page the page wants me download it

At this point don't forget to edit your conf/httpd.conf file and
make sure the file contains the line for PHP 3:

AddType application/x-httpd-php3 .php3

Or this line for PHP 4:

AddType application/x-httpd-php .php
 
Old 06-06-2007, 03:27 PM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Was /usr/lib/httpd/modules/libphp4.so installed even though there were rpm errors? If not, you may be able to force an uninstall of the php rpm and then install it again.
 
  


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
running apache 2.2 with php 5 sharathg786 Linux - Networking 1 07-19-2006 05:23 AM
running php throug apache Sanket99 Linux - Networking 1 07-14-2006 03:31 PM
running apache/php files limp Programming 3 11-07-2004 08:10 PM
Apache not running php scripts Seventh Linux - Newbie 3 01-08-2004 08:35 PM
I got Apache and PHP running easier than in W98 fedetxf LinuxQuestions.org Member Success Stories 0 12-01-2003 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:04 AM.

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