|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have installed Apache web server and PHP.
apache runs problem free but I tried a test file including phpinfo() and with IE the page was viewed as a string. After a quick research I learned it means that the file is not interpreted by PHP and it is a server config problem. But I have checked several times my apache config, tried PHP to run as a module and as cgi. Thanks in advance. ![]() |
|
#2
|
|||
|
|||
|
As module, you have to edit/add in the httpd.conf do follows:
LoadModule php4_module c:/php/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php OR As cgi, you have to do follows: read this first at http://www.cert.org/advisories/CA-1996-11.html and then if you are really sure, insert these lines to your conf file: ScriptAlias /php/ "c:/php/" AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php.exe" You can learn more about it at http://cvs.php.net/co.php/php4/win32/install.txt .. |
|
#3
|
|||
|
|||
|
thanks mezz
LoadModule php4_module c:/php/sapi/php4apache.dll
AddModule mod_php4.c AddType application/x-httpd-php .php That's what I have done, but doesn't work. Thatswhy I am wondering, if anything else can cause this problem. Thaks again for your help. |
|
#4
|
|||
|
|||
|
All I can think of is did you reboot or restart your Apache server? When you are finishing with those, then clear your cache and test it again.
I would put php4apache.dll in the modules directory in Apache then do the LoadModule php4_module modules/php4apache.dll .. That's all I can help, so if you still have problem and wait for others. |
|
#5
|
||||
|
||||
|
First of all, you do not need "AddModule mod_php4.c", LoadModule will do just fine.
>>page was viewed as a string As who? you mean you got 'phpinfo()' as the output, dont you? Make sure its inside <?php && ?> (duh?), and that your file has extension .php
__________________
And you know I mean that. |
|
#6
|
|||
|
|||
|
thanks alcapone
I think I need to use Add Module line, because I tried as first just the Load Module and Apache has shown an error, something like ,can't clear the module php4..., the module is not in the list... And after adding the Add Module line it is ok. Now when I test apache, everything is ok.
I have created a test file with an.php extension like; <? phpinfo(); ?> and when I call this page, I see this source code in IE as an output , it is not interpreted. Thanks alot. ![]() Last edited by teknoart : January 21st, 2002 at 05:37 AM. |
|
#7
|
||||
|
||||
|
ok, have you copied all needed dll's into you system and win dir? If not do so - read the instal.txt its explained there very well.
Reason why you get source code is because you apache does not know what to do with .php files and displays them as if they were usuall .txt's so make sure your AddTandler is set properly... Here is general procedure when installing php as apache module on windows: 1) dl and unzip package 2) copy php4ts.dll into c:\windows\system 3) copy php4apache.dll into apache/modules dir (optional_ 4) add these lines into httpd.conf (or uncomment old ones for php3 and edit them) LoadModule php4_module c:/php/sapi/php4apache.dll AddType application/x-httpd-php .php That usually does the trick. Of course, dont forget to stop and start apache again. |
|
#8
|
|||
|
|||
|
hmm...... you can use "<?" by itself as the opening tag for php statements? I thought you had to use "<? php", because other languages use the "<? language" declaration to start also... or maybe I'm mistaken, who knows.
__________________
Brian |
|
#9
|
||||
|
||||
|
Yeah you can, its called 'short opening tags' or something like that, can be turned on and off in php.ini, but recommended to have <?php as opening because, like you said, some other languages use <?
|
|
#10
|
|||
|
|||
|
I tried everything you wrote again and again. <?php has not another effect. Just the output is<?php....
I've copied the dlls into Apache module directory also. Stopped, started again, rebooted.... No change no change.. I know,it is not a php problem but I have deleted all php files of version 4.1.1 and installed 4.1.0 I don't know what to do else. Do you suggest that I reinstall Apache? -- In my apache configuration any module is loaded by default, I've added LoadModule php4 at the end of the group, add type line was there Any other suggestion? Thanks alot. |
|
#11
|
||||
|
||||
|
My advice forget everything you've been doing with apache/php and start over. Clean install both apache and php, then go and read step-by-step instruction on php.net about installation on apache on windows. try both, cgi and module, btw, dlls should be in system dir, not apache/modules
|
|
#12
|
||||
|
||||
|
__________________
_____________________________ d.k.jariwala (JD) ~ simple thought, simple act ~ I blog @ http://jdk.phpkid.org |
|
#13
|
|||
|
|||
|
Might it be easier to just download and install php triad? It sets everything up for you, and for me, PHP and MySQL worked first time!
http://sourceforge.net/projects/phptriad/ |
|
#14
|
||||
|
||||
|
eek @
Quote:
what is the name of the file you have made which contains the call to phpinfo() ? make a file - call it myphpinfo.php in there put the lines Code:
<?php phpinfo(); ?> put the file into your htdocs dir - so it's accessible via the webserver. make sure that any referance in your httpd.conf actually maps the 'dot php' format to see this as a php file (I think this is your problem). Look through your httpd.conf at all the AddType calls and make sure you have one line that looks like this Code:
AddType application/x-httpd-php .php
That I think is the problem, php file isn't being seen by apache as a php file,. restart apache after making changes to httpd.conf Then open IE (or another web browser) and point it to your webserver,, the line in the URL window will look something like URL - unless you know differently ![]() Read the install.txt file that comes with PHP ![]() I wrote this down to remind me how to do it my way - but the install file is what you want.. Quote:
Sil URL PS, check the apache access and error logs - and copy anything relevant from there to here... |
|
#15
|
||||
|
||||
|
>>if you know what this does you won't want to do it!
huh? |