Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question from a newbie.Need first source

Status
Not open for further replies.

Spent

Programmer
Mar 20, 2003
100
BG
Hi Can you give me an example of simple php source file.I have apache 2.0 installed. Do I need to change any settings to the server so that it executes php files.
Thanks !

Spent
 
Your first php file can be called something like info.php and to test it out to make sure php is working on your server the code would be:
Code:
<?php
phpinfo();
?>

To run php you have to add some stuff to the httpd.conf file of apache. You can go here for instructions:
If you have any other questions let us know.

---------------------------------------
 
I would like to add a follow-on question to Spent's.

I am a complete newbie and I just got PHP 4 to run on my PC. I am using MS Windows XP Pro, SP2, and Apache 2.

How/where/in what environment would I type in the test program you suggested to Spent?

Thanks,
 
You can type it into any text editor -- with Windows you can use Notepad, for example. Save it in whatever folder you'll be keeping php files in.
 
Thanks for your help aardvark92, but how do I run a php program?

I have been able to run a test program from a browser in a test directory by double-clicking on the .php file in the directory listing.

How do I get the program to run automatically by going to the web address?

Can I run a php from inside an HTML? If so, how?

Thanks again.

 
When you want to run the php code, you have to do this via your web-browser.

You have a document-root somewhere on c:, I'd guess, but to visit your own web-server, you'll do this:


if you have not set up apache and php properly, I know there is a good tutorial on php.net

Do not use apache 2.0 with php! use 1.3.3

Olav Alexander Mjelde
Admin & Webmaster
 
Thanks for your input. I still don't understand how I would run the php test code from my browser but I will go through the tutorial before I waste everybody's time.

Your warning not to use Apache 2 with PHP concerns me.

It has teken me forever to get to this point and I am very reluctant to start over. For now I am just using the tool to learn how to program with PHP and MySQL.

Since my needs are extremely modest and do not involve a production site, can I continue to use Apache 2, or is a step back to 1.3.3 my best bet?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top