?
Solved

Asking me to save the page - APACHE SERVER AND PHP

Posted on 2006-05-09
38
Medium Priority
?
2,423 Views
Last Modified: 2013-12-13
Hi experts, I just installed apache and and testing it with php.

when I type http://localhost/ on ie - nothing happening - page not found. but, it worked earlier.. but, now, I am trying to set up httpd.conf file and having some tough time..

I have this help instruction:

# Add to the end of the LoadModule section
LoadModule php5_module "C:/php/php5apache.dll" <<notice the slash difference

# Add to the end of the AddModule section
AddModule mod_php5.c

# Add this line inside the <IfModule mod_mime.c> conditional brace
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps

IMP:restart apache

and when I test a page with a phpinfo(); is it asking me to save..

It happened before year ago.. and I fixed it with this solution above.. but, not this time..

any help ?

Thanks all
0
Comment
Question by:neonlights
  • 20
  • 9
  • 8
  • +1
38 Comments
 

Author Comment

by:neonlights
ID: 16641832
"http://localhost/" is working fine now - since I stopped the service and start again. but,  still for php - asking me to save the file. This is what I have in the test.php file.

<?php
phpinfo();
?>

and so far, this is what I have added in the httpd.conf

1) LoadModule php5_module "C:/php/php5apache2.dll" in the LoadModule (list of load modules there)

2) AddType application/x-httpd-php .php .htm .html in the end of the AddType - already there...

where is the problem?

Thanks all
0
 
LVL 16

Expert Comment

by:dr_dedo
ID: 16642219
LoadModule php5_module "c:/php/php5apache.dll"
AddModule mod_php5.c
AddType application/x-http-php .php

or you can run php as CGI

try this
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"
0
 

Author Comment

by:neonlights
ID: 16642530
Hi dr_dedo,

thanks for your answer. However,

right now, I have

LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php

and when I "start" and it is running.

but, when I add the line:

AddModule mod_php5.c

getting error

Requested operation has failed
and when I looked at the access log:


Syntax error on line 175 of C:/Program Files/Apache Group/Apache2/conf/httpd.conf:
Invalid command 'AddModule', perhaps mis-spelled or defined by a module not included in the server configuration
127.0.0.1 - - [09/May/2006:14:26:07 -0400] "GET / HTTP/1.1" 200 1552
127.0.0.1 - - [09/May/2006:14:26:07 -0400] "GET /apache_pb.gif HTTP/1.1" 200 2326

Do you know what is happening?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16645948
OOI, what happens if you put the slashes in the DOS way and not the unix way?

e.g.

LoadModule php5_module "C:\php\php5apache2.dll"
0
 

Author Comment

by:neonlights
ID: 16647869
when I change the slash and restart - it is working...

LoadModule php5_module "C:\php\php5apache2.dll"
AddType application/x-httpd-php .php

then, when I add the AddModule mod_php5.c getting error.

Thanks .. again.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16647969
Not knowning Apache that well, but why do you need both?

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16647977
From the PHP Manual on installing PHP into Apache ...

Installing as an Apache module
You need to insert these two lines to your Apache httpd.conf configuration file to set up the PHP module for Apache 2.0:

Example 4.6. PHP and Apache 2.0 as Module
copy to clipboard
# For PHP 4 do something like this:
LoadModule php4_module "c:/php/php4apache2.dll"
# Don't forget to copy the php4apache2.dll file from the sapi directory!
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"

Mo mention of addModule
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16647988
Aha!

You are using Apache V2. This uses the above method.

Apache V1 uses ...

For PHP 5:

copy to clipboard
# Add to the end of the LoadModule section
LoadModule php5_module "C:/php/php5apache.dll"

# Add to the end of the AddModule section
AddModule mod_php5.c

# Add this line inside the <IfModule mod_mime.c> conditional brace
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps



I think this is why you are getting confused. Wrong version of Apache.
0
 

Author Comment

by:neonlights
ID: 16648022
I do not know .. But, I had this problem last year or so.. and I posted this question .

This is previous question I posted: http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Windows/Q_21654363.html

you will see..... and I am trying to do that samething  - not working this time.. whenever i am trying view my test.php - keep asking me to save - it exactly happened last time.

thanks

These are steps he gave me:

# Add to the end of the LoadModule section
LoadModule php5_module "C:/php/php5apache.dll" <<notice the slash difference

# Add to the end of the AddModule section
AddModule mod_php5.c                          ************ I do not have no AddModule in my httpd.conf *****

# Add this line inside the <IfModule mod_mime.c> conditional brace ************ I do not find this IfModule mod_mime.c in my httpd.conf}
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps


and worked perfectly fine.. one shot.. but, not this time..
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16648044
What version of Apache?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16648056
From the PHP Manual relating to Apache 2.0.x on Microsoft Windows.

Note:
Remember to substitute your actual path to PHP for the c:/php/ in the above examples. Take care to use either php4apache2.dll or php5apache2.dll in your LoadModule directive and not php4apache.dll or php5apache.dll as the latter ones are designed to run with Apache 1.3.x.

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16648065
You do not need to use AddModule for Apache 2.x (according to the dox), only for Apache 1.x
0
 

Author Comment

by:neonlights
ID: 16648098
hi RQuadling,

Thanks for your help.
OK.
Appache HTTP Server 2.0.58 - I installed it from file: apache_2.0.58-win32-x86-no_ssl.exe

and I installed my php from php-5.1.4-Win32

Let me know what do you think.. meantime, I will read your suggestions above...
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 1000 total points
ID: 16648126
I've just read the other question and that all relates to Apache 1 (1 - the use of php5apache.dll and not php5apache2.dll and 2 - the use of AddModule).

Take a read of http://www.php.net/manual/en/install.windows.manual.php and http://www.php.net/manual/en/install.windows.apache2.php

Then take a look at http://www.php.net/manual/en/install.windows.apache1.php to see the differences.

0
 

Author Comment

by:neonlights
ID: 16648169
Thank you RQuadling.. I am reading those articles. Thanks for those links.. will get back to you.. .shortly..

thanks again for your help.

0
 

Author Comment

by:neonlights
ID: 16649417
Hi RQuadling,

Not much luck. I followed suggested sites.

I will tell you what I did so far.

1) according to the site: http://www.php.net/manual/en/install.windows.apache2.php

I made these changes to the httpd.conf

LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

2) Then, according to this site: http://www.php.net/manual/en/install.windows.manual.php

I made these changes:
  1) We advise you remove all of these files (like php.ini and PHP related DLLs from the Windows SYSTEM folder
  2) To make php4ts.dll / php5ts.dll available you have three options: copy the file to the Windows system directory, copy the file to the web server's directory, or add your PHP directory, C:\php to the PATH. For better maintenance, we advise you to follow the last option, add C:\php to the PATH, because it will be simpler to upgrade PHP in the future.  ***** AND I DID THE LAST OPTION
  3) Then changed php.ini-recommended to php.ini and placed it in the c:/Windows directory.

Now, when I open a test.php - still asking me to save..

WHYYYYYY?
0
 
LVL 9

Assisted Solution

by:LinuxNubb
LinuxNubb earned 1000 total points
ID: 16651494
I have :
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

and added c:\php to my system path, and mine works great.

I assume you've at least restarted apache service since these last changes, or better yet a full system reboot?
0
 

Author Comment

by:neonlights
ID: 16651672
Hi LinuxNubb - just to makesure the compatability of versions..

1) Appache HTTP Server 2.0.58 - I installed it from file: apache_2.0.58-win32-x86-no_ssl.exe
2) I installed my php from php-5.1.4-Win32

and
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

OK, that is correct - and I already added the c:\php to my system path. - just checked .. and yes, it is also done..

and what about these files? Did you copy those files to c:\windows?

php.ini (phpphp.ini-recommended) , php5ts.dll  

and I assume that you did not make any changes to the php.ini files..

Thanks for your input.

0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16652556
I don't have the php5ts.dll in the windows directory, just the php.ini file.

I have basically the same versions as you do.

So, did you restart the PC?
0
 

Author Comment

by:neonlights
ID: 16652912
yes,  I did restart the windows..

I was wrong - I do not php5s.dll in my windows dir - for that reason, I did the "path" c:\php

and just only php.ini in the system dir

still asking me "Do you want to save this file?"

do not know what is wrong.. apache is running.. and I have:

LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php

and libmysql.dll in my c:/windows/system32

and php.ini in the c:/windows

and I gave system "path" in the control panel - systems....

What is causing me to save this file?
0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16652956
The file is trying to save because apache does not know what to do with the file type of .php.  

Your installation of php is in c:\php correct?  Not c:\program files\php.... or something?
0
 

Author Comment

by:neonlights
ID: 16653030
no, c:\php

0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16653072
How did you install php?  From the zip file or from the msi installer?
0
 

Author Comment

by:neonlights
ID: 16653094
Hi Question for you..  when I open "http://localhost/" on IE - it is bringing me the apache page..

so, apache is working fine.

now, I am creating a test page on DreamWeaver..

This is code I have:

<?php
phpinfo();
?>

so, when I hit F12 on dreamweaver, it is telling me that this page has server code, do you want to set up the server now.. what kind of information I should provide.. ? I am kind of lost there..

what I am doing all these times, I am saying "no" to setting up server.. and it is bringing up the save msgbox

do I have to setup a server?? because, my book suggesting write this code in a note pad and open that page.. and when i do that - it is opening this page in dreamweaver..

0
 

Author Comment

by:neonlights
ID: 16653109
How did I install php? - from "php-5.1.4-Win32.zip" zip file

0
 

Author Comment

by:neonlights
ID: 16653115
one mroe question: when the apache server page {http://localhost/} - what is this root dir??
0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16653150
and the dll is in that directory?  What are you getting for errors in the apache log file now?
0
 

Author Comment

by:neonlights
ID: 16653210
ok, something happening.. lol

I searched here for dreamweaver, testing server, apache

and got http://www.experts-exchange.com/Web/Q_21349454.html?query=testing+server+dreamweaver+apache&clearTAFilter=true
 

testing folder..  C:\Program Files\Apache Group\Apache2\htdocs\

and opened the test4.php which has:

<?php
phpinfo();
?>

it opened a page: for Php info in http://localhost/php4.php

what is that mean???

I am going to check other test pages that I have created..

0
 

Author Comment

by:neonlights
ID: 16653252
ok... it is kind of bizzarre..

I have 4 test php pages..

only one page is working - everything else I am getting http 404 error

only the page with (http://localhost/test4.php)

<?php
phpinfo();
?>

and when I try to open http://localhost/test3.php or 2 or 1 - nooop - not working - http 404 not found...
0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16653275
what does test3.php contain?  What if you delete them and recreate them from scratch?

What about file permission on the files?
0
 

Author Comment

by:neonlights
ID: 16653280
I stop the apache and cleaned both logs and start again.

error log has:

[Wed May 10 17:40:26 2006] [notice] Apache/2.0.58 (Win32) PHP/5.1.4 configured -- resuming normal operations
[Wed May 10 17:40:26 2006] [notice] Server built: Apr 29 2006 17:47:10
[Wed May 10 17:40:26 2006] [notice] Parent: Created child process 3368
[Wed May 10 17:40:27 2006] [notice] Child 3368: Child process is running
[Wed May 10 17:40:27 2006] [notice] Child 3368: Acquired the start mutex.
[Wed May 10 17:40:27 2006] [notice] Child 3368: Starting 250 worker threads.

That's all
0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16653348
so make a new php page, let's call it mytest.php.

Inside it put:

<?php
echo "Test";
?>

does it work?
0
 

Author Comment

by:neonlights
ID: 16653413
Haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

FINALLY - IT IS WORKING....

Dreamweaver was causing the problem.. I am not sure.. but, after I set up the "Site definition" and testing server.. finally done.

and yes, I see the message "test" but not "Test" .. haha haha

Thank you so much for your help.

RQuadling also helped me with all kinds of information. I will share my points between you two.

Thanks again for your(s) awesome work.
0
 
LVL 9

Expert Comment

by:LinuxNubb
ID: 16653443
Good deal, nothing better than getting something working after you've struggled wth it for a while!! :)
0
 

Author Comment

by:neonlights
ID: 16653666
It is true.. hopefully, I also will be able to master PHP... and MSQL soon.. lol

thanks again.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16655931
I'm glad you got this working.

One thing I would STRONGLY recommend is adding your PHP directory to the PATH.

That way you don't need to pollute the Windows directory with any more files other than the ini file. Though I believe you can use a registry setting for that too.

Also note that PHP.ini can also php-xxxx.ini where xxxx is the specific sapi being used.

So, if, like me, you also use PHP for CLI work and you don't want errors reported in HTML or logged differently or different extensions, then I use php-cli.ini and php-isapi.ini (I run Sambar Server which supports PHP via a ISAPI interface).
0
 

Author Comment

by:neonlights
ID: 16659719
Hi RQuadling,

1) "One thing I would STRONGLY recommend is adding your PHP directory to the PATH." - I already did that - in the control panel -> systems


0
 

Author Comment

by:neonlights
ID: 16659725
Thanks for your comments.. and help...

bye.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question