Link to home
Start Free TrialLog in
Avatar of neonlights
neonlights

asked on

Asking me to save the page - APACHE SERVER AND PHP

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
Avatar of neonlights
neonlights

ASKER

"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
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"
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?
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"
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.
Not knowning Apache that well, but why do you need both?

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
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.
I do not know .. But, I had this problem last year or so.. and I posted this question .

This is previous question I posted: https://www.experts-exchange.com/questions/21654363/ASKING-ME-TO-SAVE-MY-PHP-PAGE.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..
What version of Apache?
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.

You do not need to use AddModule for Apache 2.x (according to the dox), only for Apache 1.x
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...
ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you RQuadling.. I am reading those articles. Thanks for those links.. will get back to you.. .shortly..

thanks again for your help.

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?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

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?
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?
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?
no, c:\php

How did you install php?  From the zip file or from the msi installer?
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..

How did I install php? - from "php-5.1.4-Win32.zip" zip file

one mroe question: when the apache server page {http://localhost/} - what is this root dir??
and the dll is in that directory?  What are you getting for errors in the apache log file now?
ok, something happening.. lol

I searched here for dreamweaver, testing server, apache

and got https://www.experts-exchange.com/questions/21349454/Can-Dreamweaver-Run-With-Apache-On-Windows-XP.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..

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...
what does test3.php contain?  What if you delete them and recreate them from scratch?

What about file permission on the files?
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
so make a new php page, let's call it mytest.php.

Inside it put:

<?php
echo "Test";
?>

does it work?
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.
Good deal, nothing better than getting something working after you've struggled wth it for a while!! :)
It is true.. hopefully, I also will be able to master PHP... and MSQL soon.. lol

thanks again.
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).
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


Thanks for your comments.. and help...

bye.