Jump to content

I don't really know what I'm doing...


Recommended Posts

I like to think that I'm good at HTML, Javascript, CSS, and all that, but I decided to try and learn PHP. I got this nice-looking PHP book, but even with an entire chapter dedicated to installing PHP, I just can't get it to work.

 

I downloaded and installed Apache. I ran apache.exe and typed in http://127.0.0.1/. in the address bar of my Web Browser and I got the confirmation site saying a local server is running. Yay! Next, I went into Control Panel, Administrative Tools, and Services and saw that Apache is running as a service. Yay! Then I downloaded PHP 5.0 and copied a file called php.ini-recommended into my C:\WINDOWS directory and renamed it php.ini. The next step (and final step, according to the book) is where I seem to be stuck.

 

The book tells me to open a file called httpd.conf and add the following lines of "code" to it:

- LoadModule php5_module C:\Documents and Settings\HP_Owner\My Documents\php-5.0.0RC2-Win32\php5apache.dll

- AddModule mod_php5.c

- AddType application/x-httpd-php .php

 

Once I added those lines, I created an HTML file with some PHP code and the PHP code did not work. It was just the phpInfo(); function, so it's not the code's problem, I obviously messed up installing PHP. I have no idea what I did wrong.

Link to comment
Share on other sites

Firstly, when you make changes to the httpd.conf file you need to restart apache for the changes to take effect. You never mentioned restarting, so that the first thing I would do.

 

Secondly, php cannot run in files ending in the .html extension (well it can, but not with a default configuration) you file must be named *.php in order to be processed by php.

 

And thirdly, where did you place this file in order to view it? It needs to go in your servers DocumentRoot directory. You can find where this is by looking at this DocumentRoot directive within the httpd.conf file.

 

If your still having problems you might find installing something like xampp (google it) easier. This will install everything that is required to get started. Apache configured with php as well as the mysql server database you will eventually need.

 

Your trying to learn php after all, not server administration.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.