LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 02-17-2010, 11:21 PM   #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-17-2010, 11:28 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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-17-2010, 11:52 PM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

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-17-2010 at 11:55 PM.
 
Old 02-18-2010, 12:19 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

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, 12:25 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
@vinay,

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


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

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

All times are GMT -5. The time now is 03:18 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