• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

PHP Beginner needs help!

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone, could someone just set me off on the right track using PHP?

I have installed the following:

apache_2.2.4-win32-x86-no_ssl //Apache Server
mysql-5.0.27-win32 //MySQL Database SW
php-5.2.1-win32-installer //PHP for Windows

They all installed fine, and as per the book I'm following I added the following directive 'AddType application/x-httpd-php .php' to the file:

C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd

and saved it. So now on opening PHP script in explorer the PHP engine should be invoked surely?

Well I did the phpinfo(); test script and it prompts me to download the file, suggesting I have gone wrong somewhere! If anyone could help me out here I'd appreciate it, so I can get learning PHP!
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Last time I knew the 2.2 version of apache didn't work on a windows machine with php. I had to use the 2.0.54 (or something like that) for it to work. I don't know if that has changed lately, as I haven't installed or looked into it in quite a while.


Tony
[ February 11, 2007: Message edited by: Tony VanHorn ]
 
Hugh Mclaughlin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cheers Tony I'll find that version then!


Edit: I found 2.0.59 only, the previous ones I cannot seem to find. I'll try 59 and see what happens!
[ February 11, 2007: Message edited by: Hugh Mclaughlin ]
 
Hugh Mclaughlin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I tried that one and it still did not work, so I'm starting from scratch. Could you give me a hand and tell me which version of PHP and version of Apache to use on Windows XP? And whereabouts to download them, I'd really appreciate the help. There seem to be soo many different ones out there!
 
Tony VanHorn
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, you first need to download Apache_2.0.59-win32-x86-no_ssl.msi from Apache Downloads (this is a self installer). You will also need PHP-5.2.1-Win32.zip from the PHP download page. Once you have those two files downloaded, first install apache by double clicking on the self installer. Just follow the instructions as you go through it. If you are just wanting this on your machine to be able to test your code then type in localhost when it ask for the web address and name.

After that is complete, unzip the php zip file into a folder (I would suggest c:/php/). After unzipping the folder you will find a file called 'php.ini-dist'. Take and copy this file into your windows folder, it should be located at c:/windows/, then rename the file taking the '-dist' off of it leaving 'php.ini'.

Open the file in note pad and make the following changes. Look for the LoadModule area and add the following line:

Save and close the file (making sure that it is saved as php.ini in the windows folder).

Then open up, in notepad, the file called httpd.conf (the config file for apache). There are actually a couple of ways to do this. You can browse to it inside the windows explorer, or under the start menu there is an easier way of getting to it. Click Start / All Programs / Apache HTTP Server 2.0.59 / Configure Apache Server / Edit the httpd.conf. Once the file opens you need to change a few things. First:

That way when you connect to the server it looks for a index.php file first then the .html

Second add this to the end of the LoadModule area:

Next, add the following line to the end of the document on a new line:

Then look for DocumentRoot and change to the following:

Make sure that the folder exists on your hard drive. Then you can save all your files to this location and find them easier instead of having to navigate through the file tree of the apache server.

Lastly look for <Directory blahblahblah> and change to match the document root:


Then restart your server and you should be all set to go. To test it out put the following code into a text file and save it as index.php in your servers document root directory (www/).

Open your browser and type localhost into the address bar. Ta-Da. Done.

Hope that helps
**EDIT**
I had to change a few things, as all the changes need to be done in the apache config file. Nothing needs to be changed in the php.ini file unless you were want to add full mail support or turn on global variables (which I suggest you do not do).

Tony

[ February 11, 2007: Message edited by: Tony VanHorn ]
[ February 20, 2007: Message edited by: Tony VanHorn ]
 
Hugh Mclaughlin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's great Tony, thanks for all the help! I couldn't find the LoadModule area to enter that new line, but that test php file and a couple of others I have knocked together work! So all is good, cheers buddy!
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic