# Apache builds

- Thread: https://externals.io/message/39072
- Original archive: https://news-web.php.net/php.internals/39072
- Started by Steph Fox on 2008-07-18T02:38:37+00:00
- Messages: 12
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #39072 — Steph Fox — 2008-07-18T02:38:37+00:00

URL: https://externals.io/message/39072#39072

Hi all,

I've been struggling a bit with Apache tonight. I'd hoped to send real 
patches at the end of it, but...

I got sapi/apache to build by adding a direct include for zend_globals.h to 
php_apache_http.h. I have no idea why the apache sapi would suddenly want 
that, I just know it showed no interest in anything else on offer - up to 
and including giving it the entire Zend library. This could be just my setup 
(experimental at present) and is almost certainly Windows-only even if it 
isn't, so I'll leave that one for others to comment.

The apachefilter sapi must have been broken across all platforms since the 
arrival of re2c. I got it to build like so (patch inlined because it 
shouldn't be used, just demonstrating the problem):

Index: sapi/apache2filter/sapi_apache2.c
===================================================================
RCS file: /repository/php-src/sapi/apache2filter/sapi_apache2.c,v
retrieving revision 1.136.2.2.2.8.2.2
diff -u -r1.136.2.2.2.8.2.2 sapi_apache2.c
--- sapi/apache2filter/sapi_apache2.c 18 Mar 2008 22:23:20 -0000 
1.136.2.2.2.8.2.2
+++ sapi/apache2filter/sapi_apache2.c 18 Jul 2008 02:20:05 -0000
@@ -523,8 +523,7 @@
  zfd.handle.stream.handle = pbb;
  zfd.handle.stream.reader = php_apache_read_stream;
  zfd.handle.stream.closer = php_apache_close_stream;
- zfd.handle.stream.fteller = php_apache_fteller_stream;
- zfd.handle.stream.interactive = 0;
+ zfd.handle.stream.fsizer = php_apache_fteller_stream;

  zfd.filename = f->r->filename;
  zfd.opened_path = NULL;

Obviously this is not a correct fix, but it appears to work; it gives me a 
build with only 2 minor warnings from the PHP side of the equation under 
VC6. If someone with a working brain could supply a proper fix before the 
5.3 beta 'twould be good.

No other sapis in core are affected by the fteller/fsizer changes.

Thanks,
- Steph

---

## #39076 — Pierre Joye — 2008-07-18T07:21:25+00:00

URL: https://externals.io/message/39072#39076 · In reply to: #39072

hi,


>
> Hi all,
>
> I've been struggling a bit with Apache tonight. I'd hoped to send real
> patches at the end of it, but...

It is not due to re2c introduction but to changes committed only in
one branch and never merged to HEAD. Then good developers worked in
HEAD and merged to 5.3 ending with the current mess. See for the
initial report:

http://news.php.net/php.internals/38776

Scott is working on it.

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #39082 — Steph Fox — 2008-07-18T10:34:34+00:00

URL: https://externals.io/message/39072#39082 · In reply to: #39076

Pierre,

> It is not due to re2c introduction but to changes committed only in
> one branch and never merged to HEAD. Then good developers worked in
> HEAD and merged to 5.3 ending with the current mess.

Y'know, attacking me every time I make a move is counterproductive. In this 
case, it means that anybody who has a clue about fixing the problem won't 
bother reading my initial post.

http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ini_scanner.h?view=log tells 
me that a) the commit was made in 5_3 and merged to HEAD ten days later (and 
nobody screamed), b) that the changes are part of that patch and c) that the 
same problem exists in both branches.

I would have spent today on HEAD, but unfortunately I have work outstanding 
in 5_3 branch because of all this silliness. It's likely to be Sunday before 
I can get to it now.

Anyone who actually knows how to fix the apache2filter sapi to use the new 
zend_stream struct introduced as part of the re2c changes is welcome to 
comment, assuming they got as far as this.

- Steph

---

## #39083 — Pierre Joye — 2008-07-18T11:01:16+00:00

URL: https://externals.io/message/39072#39083 · In reply to: #39082

>
> Pierre,
>
> > […]
>
> Y'know, attacking me every time I make a move is counterproductive.

I have no idea what makes you think that my reply was a personal
attack and seriously, it does not matter.

My reply was an informative answer, to explain why and when
apache2filter was broken. Let me rephrase it in less ambiguous way:

- John changed things in 5.x but did not merge them in HEAD
- re2c devs have been done in HEAD
- re2c got merged to 5.3 and reintroduced stuff that were not
needed/used anymore
- As Scott is working in this area right now, he's volunteered to fix
it as soon as possible.


> I would have spent today on HEAD, but unfortunately I have work outstanding
> in 5_3 branch because of all this silliness. It's likely to be Sunday before
> I can get to it now.
>
> Anyone who actually knows how to fix the apache2filter sapi to use the new
> zend_stream struct introduced as part of the re2c changes is welcome to
> comment, assuming they got as far as this.

re2c did not introduce the apache2 changes, that's why I tried to tell
you in the first reply.

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org

---

## #39084 — Scott MacVicar — 2008-07-18T11:08:21+00:00

URL: https://externals.io/message/39072#39084 · In reply to: #39082

Hey Steph,

John worked on apache2filter and for some reason he only made a change 
to do with streams on the 5.x branch [1] and never merged his change to 
head. It means that currently apache2filter works on HEAD but not on PHP 5.3

I've not yet had time to see if there is a way to get a length of 
content from a previous brigade in Apache. We may just need to buffer 
the result and then call it? I'm unsure at the moment.

Also I dont think the apache filter SAPI is in use by anyone, but I 
could be wrong here.

Scott

[1] - 
http://cvs.php.net/viewvc.cgi/php-src/sapi/apache2filter/sapi_apache2.c?view=log#rev1.136.2.2.2.1


Steph Fox wrote:
> 
> Pierre,
> 
> > […]
> 
> Y'know, attacking me every time I make a move is counterproductive. In 
> this case, it means that anybody who has a clue about fixing the problem 
> won't bother reading my initial post.
> 
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_ini_scanner.h?view=log 
> tells me that a) the commit was made in 5_3 and merged to HEAD ten days 
> later (and nobody screamed), b) that the changes are part of that patch 
> and c) that the same problem exists in both branches.
> 
> I would have spent today on HEAD, but unfortunately I have work 
> outstanding in 5_3 branch because of all this silliness. It's likely to 
> be Sunday before I can get to it now.
> 
> Anyone who actually knows how to fix the apache2filter sapi to use the 
> new zend_stream struct introduced as part of the re2c changes is welcome 
> to comment, assuming they got as far as this.
> 
> - Steph

---

## #39085 — Steph Fox — 2008-07-18T11:10:35+00:00

URL: https://externals.io/message/39072#39085 · In reply to: #39083

Pierre,

> I have no idea what makes you think that my reply was a personal
> attack

History?


Let me rephrase that. Look at the actual commit.

> - As Scott is working in this area right now, he's volunteered to fix
> it as soon as possible.

In that case, wouldn't it be nice if Scott were allowed to reply to my 
question without all this barracking from you?

> re2c did not introduce the apache2 changes, that's why I tried to tell
> you in the first reply.

There were no apache2 changes, that's the point.

- Steph

---

## #39086 — Steph Fox — 2008-07-18T11:21:21+00:00

URL: https://externals.io/message/39072#39086 · In reply to: #39084

Hi Scott, thanks,

> John worked on apache2filter and for some reason he only made a change to 
> do with streams on the 5.x branch [1] and never merged his change to head. 
> It means that currently apache2filter works on HEAD but not on PHP 5.3

Ahhhhhhhhhhh it was 2 years ago in 5_2 branch.

> I've not yet had time to see if there is a way to get a length of content 
> from a previous brigade in Apache. We may just need to buffer the result 
> and then call it? I'm unsure at the moment.

Isn't it just a case of rewriting php_apache_fteller_stream() to use the new 
API?

> Also I dont think the apache filter SAPI is in use by anyone, but I could 
> be wrong here.

I suppose the chances of throwing it out are zero...

Cheers,

- Steph

---

## #39087 — Scott MacVicar — 2008-07-18T11:34:31+00:00

URL: https://externals.io/message/39072#39087 · In reply to: #39086

Steph,

Steph Fox wrote:
> 
> Hi Scott, thanks,
> 
> > […]
> 
> Ahhhhhhhhhhh it was 2 years ago in 5_2 branch.
> 
> > […]
> 
> Isn't it just a case of rewriting php_apache_fteller_stream() to use the 
> new API?
> 
> > […]
> 
> I suppose the chances of throwing it out are zero...

I think we can actually just add an fsizer function and use 
apr_brigade_length(pbb->bb);

That should give us the length of all the data in the bucket brigade, 
not tested as I'm not even sure about how to go about doing so. I'll 
commit a patch later today to 5.3 and then merge all these missed 
changes to HEAD.

> 
> Cheers,
> 
> - Steph

Scott

---

## #39088 — Steph Fox — 2008-07-18T11:54:58+00:00

URL: https://externals.io/message/39072#39088 · In reply to: #39087

Scott,

> > […]
>
> I think we can actually just add an fsizer function and use 
> apr_brigade_length(pbb->bb);

I think that's what 'rewriting php_apache_fteller_stream() means ;) Why move 
it from pbb->total_len?

> That should give us the length of all the data in the bucket brigade, not 
> tested as I'm not even sure about how to go about doing so. I'll commit a 
> patch later today to 5.3 and then merge all these missed changes to HEAD.

Cool,

- Steph

---

## #39089 — Pierre Joye — 2008-07-18T11:55:20+00:00

URL: https://externals.io/message/39072#39089 · In reply to: #39085

> In that case, wouldn't it be nice if Scott were allowed to reply to my
> question without all this barracking from you?

Nobody's interested in your personal vendettas. We are here to work
and get things done, not to read things like that every two days. A
question can get answers from anyone, if you can't live with that, I'm
sorry for you. It is also not hard to keep the discussions here or on
any other places at a polite and technical level, please do it.

-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #39090 — Scott MacVicar — 2008-07-18T13:08:43+00:00

URL: https://externals.io/message/39072#39090 · In reply to: #39088

I've committed a fix now and it compiles correctly, I also removed the 
two warnings.

Scott

Steph Fox wrote:
> 
> Scott,
> 
> > […]
> 
> I think that's what 'rewriting php_apache_fteller_stream() means ;) Why 
> move it from pbb->total_len?
> 
> > […]
> 
> Cool,
> 
> - Steph

---

## #39091 — Steph Fox — 2008-07-18T13:28:17+00:00

URL: https://externals.io/message/39072#39091 · In reply to: #39090

> I've committed a fix now and it compiles correctly, I also removed the 
> two warnings.

You're the man :)

- Steph
