LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2007, 08:52 AM   #1
strycnine
Member
 
Registered: Jul 2006
Location: Romania
Distribution: Fedora 12
Posts: 160

Rep: Reputation: 31
php_newbie


Hi, I found a tutorial to learn php...all it's good.
I make the example from tutorial
with extension *.php
<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>

In my tutorial doesn't say how to run it.
I tried file://file.php in browser
but shows me:
echo "Hello World";
?>

What do I have to do??
thanks
 
Old 11-14-2007, 10:11 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
load it to a php enabled server and then go that hyperlink

[removed link]

Last edited by crabboy; 11-14-2007 at 09:44 PM. Reason: removed spamming link
 
Old 11-14-2007, 09:47 PM   #3
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
contusion, you've been asked in previous posts to stop posting the same link in your messages. Please put links like this in your signature.
 
Old 11-14-2007, 11:39 PM   #4
german
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
Quote:
Originally Posted by strycnine View Post
Hi, I found a tutorial to learn php...all it's good.
I make the example from tutorial
with extension *.php
<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>

In my tutorial doesn't say how to run it.
I tried file://file.php in browser
but shows me:
echo "Hello World";
?>

What do I have to do??
thanks
If you want to get started quickly without learning how to set up a production web server such as apache or a production SQL server such as mysql, look at XAMPP. It gives you everything you need in one bundle to start writing PHP and perl applications.

HTH
 
Old 11-16-2007, 12:56 PM   #5
strycnine
Member
 
Registered: Jul 2006
Location: Romania
Distribution: Fedora 12
Posts: 160

Original Poster
Rep: Reputation: 31
Contusion how do I load my *.php into a php enabled server??
I started the /etc/rc.httpd thing
thx

Last edited by strycnine; 11-16-2007 at 01:00 PM.
 
Old 11-16-2007, 01:34 PM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Do you have PHP installed? Put the file in the directory where pages are served from for your the server (you'll probably want to check the httpd.conf file for this, it'll be something like /var/www though but I can't be certain).
 
Old 11-16-2007, 06:09 PM   #7
edgarmolina
LQ Newbie
 
Registered: Nov 2007
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by Nylex View Post
Do you have PHP installed? Put the file in the directory where pages are served from for your the server (you'll probably want to check the httpd.conf file for this, it'll be something like /var/www though but I can't be certain).
put the file in your apache pages directory like /var/www or c:\Program Files\Apache\www and open in your web browser something like this, http://localhost/name.php, where name is the name of your file, and to know if apache (httpd) is running simply open http://localhost/, and finally, never use file:// to open a php script, that opens the php as a text file and dont execute it.
 
Old 11-17-2007, 06:57 AM   #8
strycnine
Member
 
Registered: Jul 2006
Location: Romania
Distribution: Fedora 12
Posts: 160

Original Poster
Rep: Reputation: 31
Hi again, I put my file 1.php in /var/www and tried http://localhost/1.php
and it said Not Found;(and the apache server in started)
And I have php installed.
if I type only http://localhost/
it says: It works!!
thx
 
Old 11-17-2007, 01:15 PM   #9
god93
LQ Newbie
 
Registered: Nov 2007
Location: Newcastle, England, Uk, Europe, The World, The Solar System
Distribution: Ubuntu Gusty Gibbon 7.10
Posts: 3

Rep: Reputation: 0
U need to host it somewere... just make an accound on a free host and host on there... so you can see if you code works its what i did when i started to learn php. or install apache, install php and fire up you own server
 
Old 11-17-2007, 02:06 PM   #10
brazilnut
Member
 
Registered: Nov 2007
Posts: 113

Rep: Reputation: 16
In your 'httpd.conf' file, make sure you have a line something like this:
Code:
AddType application/x-httpd-php .php .phtml .html
so that it knows to interpret files with those extension with the parser. Also make sure the file has the appropriate permissions, -rw-rw-r-- will prolly do...
 
Old 11-19-2007, 01:46 PM   #11
strycnine
Member
 
Registered: Jul 2006
Location: Romania
Distribution: Fedora 12
Posts: 160

Original Poster
Rep: Reputation: 31
Hi it's me again...
I put 1.php in /var/www, I add "AddType application/x-httpd-php .php .phtml .html .htm" to httpd.conf and I started apache(apachectl -k start) and when I type http://localhost
it give me to download a thing 'which is a: application/x-httpd-php from http://localhost'
I hope you have time and pacience with me.
thx
 
Old 11-19-2007, 02:04 PM   #12
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You may need to add a LoadModule directive to your httpd.conf file as well, though I'm not sure.
 
  


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



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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