Author |
|
dtikasingh
Joined: 19 Aug 2008 Posts: 6 Location: UK
|
Posted: Tue 19 Aug '08 21:21 Post subject: PHP Installation on Apache...HELP |
|
|
OK...I installed MySQL, Apache and now PHP. When trying to integrate php to work with Apache I believe I have followed on the correct config steps outlined. When I create a test to show phpinfo() it does not work. My code is simply: <?php phpinfo(); ?>. This is created in a document using notepad++ and named phpinfo.php. When I place this is htdocs in the Apache directory and test in my browser, the page just outputs the code above. I have tried many attempts to change the config file but still get the same output. I am running VISTA, php 5, Apache 2.2. Can someone help? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Tue 19 Aug '08 21:27 Post subject: |
|
|
Is this line uncommented in httpd.conf?
AddType application/x-httpd-php .php
Have you been restarting Apache between config changes? |
|
Back to top |
|
dtikasingh
Joined: 19 Aug 2008 Posts: 6 Location: UK
|
Posted: Tue 19 Aug '08 22:51 Post subject: |
|
|
The line is uncommented. In fact I also have added
Code: | AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps |
and these as well:
Code: | AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps |
not to mention:
Code: | PHPIniDir "C:/php/"
Loadfile "C:/php/php5ts.dll"
LoadModule php5_module "C:/php/php5apache2_2.dll" |
I have been restarting apache in between changes. I just don't get it. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Wed 20 Aug '08 0:41 Post subject: |
|
|
I've never had much luck going that route .. works sometime .. sometimes not (my story with mod_fcgid as well).
I read somewhere once to
move copy of php.ini into c:\windows
move copy of php5ts.dll into c:\windows\system32
add just 2 lines to httpd.conf
LoadModule php5_module c:/php/php5apache2_2.dll
AddType application/x-httpd-php .php
This setup has never failed me. I only forget to overwrite php5ts.dll with the new one when upgrading PHP but I know my mistake immediately on Apache start which then reminds me to diff the two ini files to see if anything was added or removed. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
dtikasingh
Joined: 19 Aug 2008 Posts: 6 Location: UK
|
Posted: Wed 20 Aug '08 11:06 Post subject: |
|
|
I have tried all above and I still get just the code displayed on the screen.
I have also put these lines in the php.ini file:
Code: | doc_root = "C:\php\
and extension_dir = "C:\Program Files\Apache Software Foundation\Apache2.2\modules" |
I have looked at the basic Troubleshooting help as well and seem to be doing all of that as well. Could I be overlooking something? |
|
Back to top |
|
dtikasingh
Joined: 19 Aug 2008 Posts: 6 Location: UK
|
Posted: Wed 20 Aug '08 13:07 Post subject: |
|
|
OK... I was able to reinstall apache and do the config again.
When i test phpinfo () i get this error:
Quote: | Failed to Connect
The connection was refused when attempting to contact localhost. |
Then I did some reading on Apache and tried to use
http://127.0.0.1:8080/phpinfo.php and it worked.
Why would it not work with localhost/phpinfo.php?
Does this mean it will work like this and I am in the free?? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 20 Aug '08 13:20 Post subject: |
|
|
!! Port 8080!
Change in your httpd.conf Listen 8080 to Listen 80 |
|
Back to top |
|
dtikasingh
Joined: 19 Aug 2008 Posts: 6 Location: UK
|
Posted: Wed 20 Aug '08 13:57 Post subject: |
|
|
When I change it to 80...i get errors. why not 8080?? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 21 Aug '08 15:08 Post subject: |
|
|
You can use port 8080, but than you have to use localhost:8080 in your url. Because the browser uses always port 80 for http:// connections. |
|
Back to top |
|
dtikasingh
Joined: 19 Aug 2008 Posts: 6 Location: UK
|
Posted: Thu 21 Aug '08 17:49 Post subject: |
|
|
Thanks...This has been very informative. At least now everything works and I can start learning PHP! |
|
Back to top |
|