Jump to content

apache/MySQL/php install in xp


Recommended Posts

Hello, I am new to this so pardon the basic question.  I installed Apache 2.2 on my home computer and it works.  I then installed MySQL 5.0.27 and then installed php 5.2.1.  This is a software development effort so everything is on my local computer drive.  I am using localhost to run a php test.  I keep getting error 404.  I am using a test file called test.php.  I've also made all the recommmended modifications to the httpd.conf  and php.ini files.  Can you please help?  Thanks a bunch.

Link to comment
Share on other sites

Hello, I am new to this so pardon the basic question.  I installed Apache 2.2 on my home computer and it works.  I then installed MySQL 5.0.27 and then installed php 5.2.1.  This is a software development effort so everything is on my local computer drive.  I am using localhost to run a php test.  I keep getting error 404.  I am using a test file called test.php.  I've also made all the recommmended modifications to the httpd.conf  and php.ini files.  Can you please help?  Thanks a bunch.

If you are getting 404 error then the php file cant be found by the server. Where are you putting the php file to? It should be placed in the document root (this is defined in the the httpd.conf) By default it will be something like this C:/Program Files/Apache Group/Apache2/htdocs).

Link to comment
Share on other sites

Thank you to both of you for the help.

 

1.  I installed XAMPP but still have the same problem.  How do you test whether the installation was successful from XAMPP.

 

2.  There are two files in the root directory C:\Program Files\Apache Software Foundation\Apache2.2\htdocs

    Index

    test.php

The Index file is the Apache test file with the message "It works!" and when I type in http://localhost/ it indeed works and I get the "It works!" message on the screen.  When I type http://localhost/test.php I get error 404.

 

Does this explain it to you so you can provide further assistance?

Link to comment
Share on other sites

Clear your browser cache or do a hard refresh (Ctrl + F5). If it still displays it works then opone up your httpd.conf and scroll to line 150 which should be this:

DocumentRoot "path/to/document/root/here"

Change path/to/document/root/here with what DocumentRoot is currently set to.

 

What is it set to?

Link to comment
Share on other sites

O.k. I pushed Ctrl+F5 and now it does not appear in the list.  test.php does show in the list and when I click on test.php, it only displays:

 

This is an html line.

 

The contents of test.php is:

<html>

<head>

<title>PHP Test</title>

</head>

<body>

<p>This is an HTML line

<p>

<?php

echo "This is a PHP line";

phpinfo();

?>

</body></html>

 

So now it appears that it soes not execute the php code.

 

BTW, the root directory is:

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

Link to comment
Share on other sites

Ok Apache is misconfigured, how have you configured Apache? Adding the following to the httpd.conf should be sufficient:

LoadModule php5_module "C:/PHP/php5apache2_2.dll";
PHPIniDir "C:/WINDOWS"

AddType application/x-httpd-php .php

 

Note -- change C:/PHP to to the correct path to PHPs folder. Save the httpd.conf and restart Apache.

Link to comment
Share on other sites

LoadModule php5_module "C:/PHP/php5apache2_2.dll"; was alredy done.

I changed PHPIniDir "C:/php" to PHPIniDir "C:/WINDOWS".

AddType application/x-httpd-php .php was already done.

 

Saved the file and restarted Apache but same problem.  Anything else I can try?  Thanks again for your time.

Link to comment
Share on other sites

did you add your php directory location (c:\php if thats it) to your path environment variable?

if you do that, its what i did, you don't need to add any php files to other places like windows

nice explanation -->http://vlaurie.com/computers2/Articles/environment.htm

also it won't matter until you actuallly get php being invoked, but it can be helpful to change the

error displaying to 'on' in php.ini, (display_errors = on), this is good for development and installation

and prob want to turn off after things running ok. you need to restart apache after changes

to php.ini

Link to comment
Share on other sites

Yes I already added the php directory location to my path environment variable.

 

And the display_errors is on also.

 

Still have the same problem.  Error 404 when I type localhost/test.php in the IE URL.  If I type localhost, it comes up with the Apache screen "It works!".  The test.php file is in the exact same location as the Apache index file (that has the "It works!" message).

Link to comment
Share on other sites

create a simple .htm(l) file and see if that gets sent ok, that should establish if its really a php prob or something peculiar in apache that just it just can't deal with anything but displaying its own index.html

 

i was having prob where the contents of my test.php was being displayed but not executed, then i tried to follow this:

http://www.apachelounge.com/forum/viewtopic.php?t=570

but had trouble understanding some of it, so what i did was,

 

-install the vc++ redistributable, not really sure what that is or what it does

-uninstall and reinstall apache but i used the .msi file, it was so easy

-put the php LoadModule, etc directives immediately after all the other LoadModule stmts in http.conf

-restart xp to be sure path variable set

and it worked after that

 

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.