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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Completely New to PHP, Can't Seem to Get PHP to Run Yet 1

Status
Not open for further replies.

Dor100

Technical User
Apr 9, 2001
279
US
Hi,

I'm starting from scratch as a newbie to PHP, but not to writing code (extensive experience with Access VBA and SQL, and a bit of html with FrontPage). Right now I'm making my way through an online PHP tutorial.

Apache 2.0.55 (Win 32) is loaded and running on the pc I'm using, which is a Novell client for Windows 2000. PHP is installed, as well as MySQL. In addition to MySQL, I will likely want to be able to use PHP with Access and possibly Oracle or SQL Server here.

Anyway, as I save simple .php pages while going through the tutorial, nothing shows up, and I don't know how to bring that about. For instance, I might save the following code as "Test.php":

<html>
<body bgcolor="yellow">

<center>
<h2>Hello</h2>
</center>

<?php

echo "Have a nice day!";

?>

</body>
</html>

Unfortunately when you open it in a browser, only the "Hello" and yellow background appear as if it were only an html page without PHP.

How do I get my pc to function as a web server and the PHP to run? There must be some step I'm not aware of. Also, if anyone wants to recommend tutorial sites for PHP and MySQL that would be appreciated. Thanks...
 
1. How are you accessing the php pages.

It should be something like:


if you're just double clicking the opage that wont work.

2. Did you enable the PHP stuff in the conf file for apache.

3. try puttng in a blank page
Code:
[red] phpinfo();[/red]
and see what you get.

4. To use different DB's you will need the different function libraries. And extensive use of the PHP online manual found here.
5. There are preassembled packages like Easyphp, that contain mysql,apachea and PHP ina nioce installer that configures everything for you.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks, Vacunita.

When I use or (h:\ is a network drive), I get a forbidden page:

***************
Forbidden
You don't have permission to access /c:/1/1.php on this server.


--------------------------------------------------------------------------------

Apache/2.0.55 (Win32) Server at localhost Port 80
***************

I didn't know about your #2 above. I'll have to look into that.
 
This:
is completelly invalid
, you cant mix http paths with flesystem paths like that.

Where is Apache and PHP installed, on the machine that holds the network drives? or On the machine your accessing the page from.

You will have to go into the Apache conf file to add directories to the web server. for example:

Apache httpd.conf said:
This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">
.
.
.
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Be especially careful to use
# proper, forward slashes here. On Windows NT, "Personal/My Website"
# is a more appropriate choice.
#
UserDir "C:/Documents and Settings/*/public_html"

I Use the UserDir, so if you get something like localhost/~paul, Apache will redirect the web request to that users Profile folder into their html folder which contains their sites files.

You need to setup the folder you want to use, or place all your php files in the documents root and call them from there.

You can set the document root anywhere you want, Sya you wanted in C:
then you would go in and change the line
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

to

<Directory "C:/somediriwant/">

Post bakc if you have any questions
.








----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Well, after changing DocumentRoot and Directory to "c:/php webs" only a 404 Not Found page would come up even though the test file (1.php) was in the folder. After setting both back to the default, "C:/Program Files/Apache Group/Apache2/htdocs," the 1.php would appear on calling from IE, but not from Mozilla; however, still only as a plain html-type page without any PHP action. Next I went to this web page:


After following the instructions at the link above to edit both the httpd.conf and php.ini files according to my own system's true location for php.ini and php5apache2.dll, I just experienced success from IE. :) Mozilla only gives a 404 error page as follows:

********************
[IBM WebSphere Edge Server banner]

Error 404 - Not found - file doesn't exist or is read protected [even tried multi].
Explanation: The requested file could not be found on the server. The server tried to match the filename exactly as specified and with every known file extension.

Action: Check to make sure the URL you entered is correct, and then retry your request.

URL: /1.php
********************

All things considered, I'm very happy to have had success with IE now, and thanks again Vancunita for helping me get started.
 
I dont quite understand why, IE works but Firefox doesn't.

But still if you got it to work on I.E. its a good start.

Now that you are coming into the wonderfull world of PHP, always remeber the online manual at is your friend. Whenever your stuck, trying to do something, go to the manual and there will most likely be a php function that does it.

If al else fails you can always come here and ask.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top