Hello All
Apologies for posting something so simple but i can't get my first PHP script to work and i was wondering if anyone could help me out.
I'm working from Sams Teach Yourself PHP, MySQL and Apache
I have just installed:
MySql 4.0.21
Apache 2.0.52
PHP5.0
& Zend Studio
The book tells you to write your first script and then test it in your web browser.
The script is as follows:
<?php
echo "Hello Web!";
?>
Are you meant to save the file in a certain place?
When typing http://localhost/first.php i should get Hello Web but i get page can't be found.
Please tell me where i'm being a plumb.
Regards
aawood
Running My First PHP Script
Moderator: General Moderators
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
Re: Running My First PHP Script
If I recall correctly, the location to store your files is c:\program files\apache\htdocs *or something similar* (do a CTRL + F for htdocs)aawood wrote:Are you meant to save the file in a certain place?
You can test your apache installation by pointing your browser at http://localhost OR http://127.0.0.1 -> it should spit out apache's default/test page.
Once you know where to save your files, create a new php file as follows:
Code: Select all
<?php
phpinfo();
?>- technofreak
- Forum Commoner
- Posts: 74
- Joined: Thu Jun 01, 2006 12:30 am
- Location: Chennai, India
- Contact:
As far as i have come through, the books for PHP doesn't point out where the readers should save their .php files, in order to get the page when accessed in the browser by typing "http://localhost/filename.php". When I started working in PHP, I also faced the same problem. Thankgod, I had friends who were working with PHP that they told me the answer.
I use Learning PHP5 from O'Reilly and PHP.net online manual. In addition to these books, effective use of online forums like devnetworks will be enough for a newbie to learn PHP fast and efficiently.
The fact to be remembered is "Learning is directly proporational to Practical Working" The more the code you write yourselves and practice, the more you learn.
I use Learning PHP5 from O'Reilly and PHP.net online manual. In addition to these books, effective use of online forums like devnetworks will be enough for a newbie to learn PHP fast and efficiently.
The fact to be remembered is "Learning is directly proporational to Practical Working" The more the code you write yourselves and practice, the more you learn.