LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   php file not run (https://www.linuxquestions.org/questions/linux-software-2/php-file-not-run-748697/)

Arjun123 08-19-2009 07:13 AM

php file not run
 
i want to run phpinfo.php file

<html>
<body>
<?php
phpinfo();
?>
</body>
</html>

and save this file to location "/var/www/html"

and i also edit the httpd.conf file
and add the module
LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php
AddType text/html .php

and when type
http://localhost/phpinfo.php ,i shows nothing on the browser

and i got following log

127.0.0.1 - - [19/Aug/2009:16:55:00 +0530] "GET /phpinfo.php HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"
127.0.0.1 - - [19/Aug/2009:16:55:00 +0530] "GET /phpinfo.php HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"

thanks

ThinkFree 08-19-2009 07:21 AM

Are your sure apache is running? What happens if you open http://localhost ?

Arjun123 08-19-2009 07:39 AM

yes it is running

ThinkFree 08-19-2009 07:48 AM

What's the output of
Quote:

ps aux|grep apache
http://localhost opens apache default page?

abefroman 08-19-2009 08:32 AM

What is the output of:
Code:

php -v
And why don't you change your HTML code to this to rule out apache problems:
Code:

<html>
<body>
<h1>hello wurld</h1>
<?php
phpinfo();
?>
</body>
</html>


abefroman 08-19-2009 08:36 AM

Quote:

Originally Posted by ThinkFree (Post 3649359)
http://localhost opens apache default page?

That doesn't sound right, if you put an index.html page in /var/www/html does it load that?

Paste your virtual host entry from httpd.conf please.

Arjun123 08-20-2009 01:03 AM

yes index.html file load
virtual host entry in httpd.conf file


### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>


All times are GMT -5. The time now is 05:48 PM.