Click to See Complete Forum and Search --> : Problem to get PHP to execute
spunkzilla
04-05-2008, 05:15 PM
Hi there!
I am new to this. Also new to PHP & MySQL. Hope someone can help me out. As I am a student I am learning to understand PHP for my assignment. I want to test PHP/HTML files through local server (that is through my machine).
I have installed IIS in my machine. I'm using XP Pro. I'm not sure if I installed PHP incorrectly. I read loads of info thru PHP.net and seems to follow the instructions on installation. Don't know if I did it correctly. Confused. Might be something I've missed.
Here's the steps I have done:
1. Install PHP 5.0 in C:\php
2. Inside Control Panel> System> Advanced tab> Environment Variables, I add PHP directory in Environment Variables & enter ;C:\php as path entry
3. Still on that, I created new path for PHPRC as variable name & enter php.ini as variable value
4. I was instructed to set the cgi.force_redirect directive to 0. It was set in php.ini
5. Did some quick coding in PHP & HTML, as example shown below:
<html>
<head>
<title>My First PHP Page</title>
</head>
<body>
<?php
echo "Hello World! ";
?>
</body>
</html>
6. Enter "http://localhost/wp/index.php" and/or "http://localhost/index.php" in address bar. The page requested with error message "The page cannot be found".
Is there something I did wrong?
Thanks in advance! :)
Cheers!
bradgrafelman
04-05-2008, 05:51 PM
If you just want a local testing environment, I would first like to advise you (actually, strongly urge you) to dump IIS and get Apache - it's much more user-friendly IMHO. If not, we can try to debug your current install w/ IIS... let us know which you decide to do.
spunkzilla
04-06-2008, 09:51 AM
Hi bradgrafelman,
Thanks for your reply!
I do have Apache installed in the machine. That was done over 12 months until I was told it's better to use IIS (is it the same as Internet Service Manager?) to execute (or parsing) PHP through local server.
I'm not sure if Apache was installed properly. I installed it in another drive, apart from C: drive. Should they be in C:\ or doesn't matter?
I was told not to use Apache as they are designed for CLI (command line). I believe that was used to parse PHP. They say use CGI instead. Correct me if I'm wrong.
Can you please describe what is user-friendly IMHO? And what is IMHO short for?
With your experience, whatever you think is the easiest for me. I just want to understand the basic from scratch; execute PHP with HTML with external style sheets through the local server and learn to use queries through MySQL, rather than executing them through a commercial web server.
I will worry about the advance stuff until later.
Thanks in advance!
Cheers! :)
laserlight
04-06-2008, 11:03 AM
I'm not sure if Apache was installed properly. I installed it in another drive, apart from C: drive. Should they be in C:\ or doesn't matter?
From what I understand, where Apache is should not matter as long as it can run, but leaving it in the default Apache subdirectory of "C:\Program Files" is probably a good idea.
I was told not to use Apache as they are designed for CLI (command line). I believe that was used to parse PHP. They say use CGI instead.
What do you mean by "they are designed for CLI"? PHP can be executed on the command line, but that has nothing to do with Apache or any web server. With Apache on Windows, you have the choice of installing PHP as an Apache module, or as a CGI binary. Installing PHP as an Apache module should be fine, but it should not matter either way since this is just for testing, so your firewall should be configured to only allow localhost access of the web server.
And what is IMHO short for?
IMHO, IMHO means In My Humble Opinion.
With your experience, whatever you think is the easiest for me. I just want to understand the basic from scratch; execute PHP with HTML with external style sheets through the local server and learn to use queries through MySQL, rather than executing them through a commercial web server.
It is cheapest to use your local computer as a testbed. It is also easier, at least once you are past the installation and configuration stage, since you do not have to meddle with file transfer.
spunkzilla
04-08-2008, 05:59 AM
Thanks for the info. Really appreciate but it's not what I'm looking for.
My fellow student suggested download XAMPP zip package and it will automatically set up.
I extracted the package on the desktop. I followed the instructions thru read me file.
I haven't done this bit before so I am new in this.
Here's the steps I have to do:
* QUICK INSTALLATION:
[NOTE: Unpack the package to your USB stick or a partition of your choice.
There it must be on the highest level like E:\ or W:\. It will
build E:\XAMPPlite or W:\XAMPPlite or something like this. Please do not use the "setup_XAMPPlite.bat" for an USB stick installation!]
Step 1: Unpack the package into a directory of your choice. Please start the
"setup_XAMPPlite.bat" and beginning the installation. Note: XAMPPlite makes no entries in the windows registry and no settings for the system variables.
Step 2: If installation ends successfully, start the Apache 2 with
"apache_start".bat", MySQL with "mysql_start".bat". Stop the MySQL Server with "mysql_stop.bat". For shutdown the Apache HTTPD, only close the Apache Command (CMD).
Step 3: Start your browser and type http://127.0.0.1 or http://localhost in the location bar. You should see our pre-made
start page with certain examples and test screens.
Step 4: PHP (with mod_php, as *.php, *.php3, *.php4, *.phtml), Perl by default with *.cgi, SSI with *.shtml are all located in => C:\XAMPPlite\htdocs\.
Examples:
- C:\XAMPPlite\htdocs\test.php => http://localhost/test.php
- C:\XAMPPlite\myhome\test.php => http://localhost/myhome/test.php
Step 5: XAMPPlite UNINSTALL? Simply remove the "XAMPPlite" Directory.
But before please shutdown the apache and mysql.
When I get to step 3 - I type http://localhost in the address bar or browser (Firefox), I always get a Authentication Required message box instructing me to 'Enter Username and Password at http://localhost".
I don't even have a username or password for that.
How can I get around this A.R. message box?
Your assistance would be muchly appreciated!
Cheers!
tapoh
04-15-2008, 06:36 AM
Dude, are you still stuck with this?
I'm a noob as well. Trying to get a testing environment install on my local PC so I can write PHP files. And I don't know what and how as well. Read what you had did and tried some. Found that the Windows ISS works!
What I did:
Installed Windows XP PRO ISS. I just ticked the default - no extra component added
Checked the http://localhost - A windows page appeared meaning the web server is working. PHP files won't work as yet.
Installed PHP 5.2.5. When it ask you what web server to choose from, I chose - ISS ISAPI module
Now write you PHP file and save as XXX.php. Put this file under C:\Inetpub\wwwroot. This is the Windows web server directory.
Open up an internet explorer and navigate to http://localhost/XXX.php
There you have it!!! You will need to uninstall everything you have and start fresh and follow my steps above. That's what I did. Hope you appreciate it, I specially register just to post this for you.
GOd Bless Dude.
sheephat
04-15-2008, 05:41 PM
Why not use a package, i think WAMPServer is the best for new users.
rbblue8
04-30-2008, 02:31 PM
Dude, are you still stuck with this?
I'm a noob as well. Trying to get a testing environment install on my local PC so I can write PHP files. And I don't know what and how as well. Read what you had did and tried some. Found that the Windows ISS works!
What I did:
Installed Windows XP PRO ISS. I just ticked the default - no extra component added
Checked the http://localhost - A windows page appeared meaning the web server is working. PHP files won't work as yet.
Installed PHP 5.2.5. When it ask you what web server to choose from, I chose - ISS ISAPI module
Now write you PHP file and save as XXX.php. Put this file under C:\Inetpub\wwwroot. This is the Windows web server directory.
Open up an internet explorer and navigate to http://localhost/XXX.php
There you have it!!! You will need to uninstall everything you have and start fresh and follow my steps above. That's what I did. Hope you appreciate it, I specially register just to post this for you.
GOd Bless Dude.
Im having the same issue.
and it;s not as simple as your install.
im very happy that it's worked for you.. but it did not for me.
to the OP. did you solve this issue?
anyone else have any suggestions?
PHP Builder
Copyright Internet.com Inc. All Rights Reserved.