Jump to content

apache2.2 with php5.2; nothing returned from php (on XP)


Recommended Posts

Hi !

I have downloaded and installed Apache2.2, and then taken steps to install PHP5.2.

This to resurrect an environment I have had before, and worked well.

All seem ok, the apache html page content comes back (using local-loop in browser) ;

and the call to PHP seems to have been executed, but it comes back as blank, i.e. nothing is inserted where

the <?php echo "xxx"; ?> was placed. No errors reported in any step.

Any ideas what could be wrong ?




Link to comment
Share on other sites

HI thanks,

well I have been looking into error loggs for apache

I also tried to make an fopen("x.dat","w"); (and fwrite and fclose)

but found no file (where i expected, ie. on htdocs where the test index.html file that im showing using explorer and localhost (http:127...)

which works fine for the html part content, but there the <?php statement just comes back as blank, and I cannot find any x.dat file create (on same dir as the .html  at least)

Guess you refer to error reporting in php ?

I have set error_reporting(E_ALL) first thing in php code (in .html doc); but i think that is already turned on since it is set in the php.ini i use.

Link to comment
Share on other sites

Hmm might be true. But its actually not LAMP right off, its winXP, with A, then not MySq but MimerSq (through ODBC), and of cause PHP.

In some way I have concluded that 5.2 is the last A that is feasible (the g disrespect of size and complexity is monumental), so Im in the museum department. (I want light and fast things).

So I guess I struggle on for a while (and see if I can understand anything).

Thanks btw.

Link to comment
Share on other sites

So I note that it doesnt seem to make a difference if PHP is configured at all in the httpd.conf file or not;

removing the loadmodule for C:/php/php5apache2_2.dll (commenting out)

does not change results; the <?php echo "xxx"; ?> statement in .html is ignored in exactly the same silent mode ...


Link to comment
Share on other sites

Hi requinix,

as I tried to explain; No there is no trace of the <?php echo "xxx"; ?> line that I have put into the index.html which contains text that I Do see in browser, when accessing through localhost address ( )


Link to comment
Share on other sites

and since I have

display_error = on

in the php.ini file, I guess that php should return any error (what could go wrong with an echo statement !?) to the browser....

My think would be; that the php code within <?php ...... ?> is not properly passed to the php engine for some reason (are there any tools to check the 'api', how the passing from apache code to the php module; i have added the global path defintion with c:\php where the php .dll files are located)

Link to comment
Share on other sites

3 hours ago, gech said:

No there is no trace of the <?php echo "xxx"; ?> line that I have put into the index.html

.html files are not processed by the php engine. (And as requinix told you, you would need to "View Source" to see any php code or anything else between <..> tags)

Try renaming that file as "index.php"

Link to comment
Share on other sites

wow, thats news;

In my old, now krasched Hd environment, any inclusion of <?php    start tag in a html code /   .html marked document would be sent and processed by php...

Ok, I have also an antiquated Internet explorer that has now clear "view source" only a button "source", which comes back with my original

file in an "notepad" window. There the php text is shown, but it is dubious whether the info is retreived via the localhost, or directly though file (since it pops up in an edit window, but that might only be old and good MS smartness)

But yes, the php code is there (but would that not just be displayed also in the browser window as "text" if php was not installed ?, does the php tag <?php give special handling (not include text) if php is not installed ? 

I will begin by downloading another browser to the work machine.


Thanx all

Edited by gech
complementing info
Link to comment
Share on other sites

SO, now I have installed another browser (firefox); and yes the php included text in the .html document is shown, although in another color (indicating that

firefox is the one that recognizes the php and removes it from display in the browser, I guess).  SO what in the installation of php in apache can have gone wrong ?


Link to comment
Share on other sites

Ok, I understand that I dont understand (,any more). I was of the impression that Apache found the php tag, and then sent the content up to the "untag", to php for processing, which return would then be inserted into the document;

you are suggesting that, instead, the php is running like some kind of preprocessing, solving all php, insering it into the document and then handing it back to apache for resolving the .html syntax parts ?

Or are you saying that I need to / have a choice to configure apache to work with <?php tags inside html labeled files ?

Edited by gech
clearer langugae
Link to comment
Share on other sites

Here's how Apache and PHP handle a request. Basically.

1. Browser sends a request to Apache. It has lots of information but all we care about is the URI (URL) that it wants. Such as "/topic/309212-apache22-with-php52-nothing-returned-from-php-on-xp/".
2. Apache takes that URL and figures out what file it corresponds to. There's a lot that can happen here, but what matters here is that Apache found a (in this case) .html file.
3a. Now it has to decide what to do with the file. Are there any modules configured that want to deal with .html files? No. Additionally, .html probably means the "text/html" type. Are there any modules to deal with text/html? No. Apache dumps the file out to the browser.
3b. Say it was a .php file instead. There are a couple ways to configure PHP but let's pick the file extension one. Any modules for .php? Yes: mod_php. Apache tells mod_php to do whatever it wants to do.
3c. The other method is very similar: nothing to handle .php, however Apache knows the file as application/x-php (or something) and there is a module (mod_php) to handle that.

Apache doesn't care about what's in the file. It cares about what type of file it is, either by extension or by type. Your setup is presumably using the .php extension (or application/x-php-something type) because that's what normal people do. Thus Apache does not know your .html files should go through PHP. Thus what you need to do is actually tell Apache that you want .html (aka text/html) files to go through mod_php, and you do that by tweaking your current "set up PHP in Apache" configuration, which may be by extension or by type, to include HTML files.

Link to comment
Share on other sites

OK thanks a lot (for your time and sharing). I guess I still have some way to go to include your thinking into my thinking.

AND yes, you were absolutely right, it works when I lift the php code out to a file extended .php (as link from the .html)

So now I probably will associate .html with the application/x-php-   in my conf file so I dont need to go trough my whole old project and change (will see if my old conf file has survived the crash (which I of cause should have done earlier).


Many thanks again.  As usual the trivial is the most difficult with computers. The absolutly worst buggs to find are those that are no buggs, just odd features.

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.

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.