LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-18-2010, 12:21 AM   #1
skyknight
LQ Newbie
 
Registered: Sep 2008
Posts: 17

Rep: Reputation: 1
php hello world not executing in linux


Hi,

I tried this code, with file name: 1.php
Code:
 <?php
   echo "Testing";
 ?>
But its not showing Testing in the browser, which part I am missing.
 
Old 02-18-2010, 12:28 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
More info needed. What distro? Is this apache? Assuming Apache: What apache related packages did you install? What php related packages did you install. What does the browser actually show?

Evo2.
 
Old 02-18-2010, 12:52 AM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
If you are using apache,

First Locate httpd.conf file.

To which directory DocumentRoot is pointing to in /etc/httpd/conf/httpd.conf file

Code:
ServerAdmin root@localhost
DocumentRoot /var/www/html
ServerName localhost
If DocumentRoot is pointing to /var/www/html then you need to keep your code under this directory.

Also make sure apache is listening to port 80 in /etc/httpd/conf/httpd.conf file

Code:
Listen 80

Last edited by vinaytp; 02-18-2010 at 12:55 AM.
 
Old 02-18-2010, 01:19 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
You need a web server to serve the php code. If you are running a Linux distribution, chances are you already have it installed or you can from the package manager. Else on windows you can use any wamp package.
Default apache configuration is enough.
Just put php pages in /var/www/html. Start the web server. And you can call the pages on the web browser as http://localhost/page-name.php. If server is remote change localhost to the name of the remote server.
 
Old 02-18-2010, 01:25 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
@vinay,

Went through the link in your sig, but you seem to be writing the post from windows xp yourself?
 
  


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
executing shell commands in PHP mohtasham1983 Programming 7 09-14-2007 12:04 PM
Problem executing a linux script from php that runs ffmpeg darkisolde Linux - Software 4 10-04-2005 08:43 AM
PHP not Executing Sometimes Herbalist Programming 3 06-20-2005 08:41 PM
How executing c program with php? payal_shah Programming 6 04-08-2005 11:44 PM


All times are GMT -5. The time now is 12:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration