You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Sindhi Sindhi <si...@gmail.com> on 2013/05/28 16:38:57 UTC

Issue in using php5_module module.

Hello,

I'm trying to setup PHP module with 64-bit Apache 2.4.4, and also load a
C++ module to do the HTML filtering. As I understand the php module acts
like an interpreter and translates the php into HTML and then invokes the
HTML output filter.

Heres my setup -
1. I downloaded Apache from
http://www.apachelounge.com/download/win64/ -> httpd-2.4.4-win64.zip
which they have built using Visual Studio 2010

2. I downloaded PHP from
http://www.apachelounge.com/viewtopic.php?p=24538 ->
php-5.4.15-Win32-VC9-x64.zip

3. Changed httpd.conf file -
LoadModule php5_module "C:/PHP/php5apache2_4.dll"

LoadModule my_filter modules/MyFilter.dll
AddOutputFilterByType MyFilter text/html text/php

<IfModule dir_module>
    DirectoryIndex *.php index.html
</IfModule>

<IfModule mime_module>
AddType application/x-httpd-php .php
</IfModule>

4. Renamed php.ini-development to php.ini and made the below changes-
short_open_tag = On
session.save_path = "c:\tmp"

My original PHP file -
<!doctype html><html><head></head><body><?php Print "Hello from PHP";
?></body></html>

With these changes, when I start httpd.exe and try to launch a simple php
file shown above, from the browser, the first time I see that my filter
module gets the correct php data from php file in the buckets. But when I
try to open the same php file second time, I see that there are some extra
strings appended to the original php file contents and sent to my filter
module in the buckets. So in my filter when I read php data from the bucket
I get the php data and some additional strings appended to the php data
like below -

"<!doctype html><html><head></head><body>Hello from PHP</body>
</html>6.26%20(KHTML,%20like%20Gecko)%20Version/6.0%20Mobile/10A5355d
%20Safari/8536.25 HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101
Firefox/22.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5........ "

Any help is highly appreciated.

Thanks.

Re: Issue in using php5_module module.

Posted by Sindhi Sindhi <si...@gmail.com>.
Thankyou Joe, I'll definitely check the the filter code.

On Tue, May 28, 2013 at 8:26 PM, Joe Lewis <jo...@joe-lewis.com> wrote:

> On 05/28/2013 08:38 AM, Sindhi Sindhi wrote:
>
>> [SNIP]
>>
>>
>> With these changes, when I start httpd.exe and try to launch a simple php
>> file shown above, from the browser, the first time I see that my filter
>> module gets the correct php data from php file in the buckets. But when I
>> try to open the same php file second time, I see that there are some extra
>> strings appended to the original php file contents and sent to my filter
>> module in the buckets. So in my filter when I read php data from the
>> bucket
>> I get the php data and some additional strings appended to the php data
>> like below -
>>
>> "<!doctype html><html><head></head><body>**Hello from PHP</body>
>> </html>6.26%20(KHTML,%20like%**20Gecko)%20Version/6.0%**20Mobile/10A5355d
>> %20Safari/8536.25 HTTP/1.1
>> Host: localhost
>> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101
>> Firefox/22.0
>> Accept: text/html,application/xhtml+**xml,application/xml;q=0.9,*/*;**
>> q=0.8
>> Accept-Language: en-US,en;q=0.5........ "
>>
>> Any help is highly appreciated.
>>
>> Thanks.
>>
>>
> Are you sure it's a problem with the php5_module and not your filter?  I
> only ask because the php5_module has been installed in numerous locations
> throughout the world, with custom modules (including an output filter of
> mine that wraps the page into a template), without issue.  I had run into a
> similar problem eons ago (I believe about 10 years or so).  In fact, I have
> one question that (if you answer honestly) will probably tell you where
> your problem is.
>
> Are you NULL-terminating all of your strings when you set them up at the
> beginning of the transaction?  If you say "yes", please send copies of
> code.  If you say "no", please fix and try again.  When I ran into that
> problem so long ago, I was mistakenly working under the assumption that the
> strings being passed around were NULL-terminated, which is not always the
> case.
>
> Joe
> --
> http://www.silverhawk.net/
>

Re: Issue in using php5_module module.

Posted by Joe Lewis <jo...@joe-lewis.com>.
On 05/28/2013 08:38 AM, Sindhi Sindhi wrote:
> [SNIP]
>
> With these changes, when I start httpd.exe and try to launch a simple php
> file shown above, from the browser, the first time I see that my filter
> module gets the correct php data from php file in the buckets. But when I
> try to open the same php file second time, I see that there are some extra
> strings appended to the original php file contents and sent to my filter
> module in the buckets. So in my filter when I read php data from the bucket
> I get the php data and some additional strings appended to the php data
> like below -
>
> "<!doctype html><html><head></head><body>Hello from PHP</body>
> </html>6.26%20(KHTML,%20like%20Gecko)%20Version/6.0%20Mobile/10A5355d
> %20Safari/8536.25 HTTP/1.1
> Host: localhost
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101
> Firefox/22.0
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-US,en;q=0.5........ "
>
> Any help is highly appreciated.
>
> Thanks.
>

Are you sure it's a problem with the php5_module and not your filter?  I 
only ask because the php5_module has been installed in numerous 
locations throughout the world, with custom modules (including an output 
filter of mine that wraps the page into a template), without issue.  I 
had run into a similar problem eons ago (I believe about 10 years or 
so).  In fact, I have one question that (if you answer honestly) will 
probably tell you where your problem is.

Are you NULL-terminating all of your strings when you set them up at the 
beginning of the transaction?  If you say "yes", please send copies of 
code.  If you say "no", please fix and try again.  When I ran into that 
problem so long ago, I was mistakenly working under the assumption that 
the strings being passed around were NULL-terminated, which is not 
always the case.

Joe
--
http://www.silverhawk.net/