# Posting problem in Apache 2.0.58-r2 with php 5.2.2-r1

## gorkha

I cannot figure out where this problem lie, but after some time I found out I wasn't able to send a html form with the post method. I get "Connection closed by remote server" if I try.

See for yourself at http://gorkha.dk/name/ - it's just a silly script generating some rubbish, if I could post.

The system is using Apache 2.0.58-r2 with php 5.2.2-r1

----------

## mudrii

check permition for the script.

----------

## gorkha

what permission and where ? :S

----------

## mudrii

where do you keep your script ?

check permission on script file ls -ln

and check the owner of the script too.

What type of the script is perl python PHP ?

----------

## gorkha

The script is a PHP script and it posts to itself, it works if I use GET not with POST.

apache is owner of the script and everyone has read, write and execute rights

----------

## hanj

Can you give me the output of the following

```
emerge -pv apache dev-lang/php
```

I want to see the USE flags involved.

Also, can you show me the contents of /etc/conf.d/apache? I want to see what's starting up with apache. Do you have suhosin installed or hardened-patch for PHP?

What is the following value set in your /etc/apache/php.ini?

```
post_max_size
```

On the processing script can you put a debug statement in there?

```
<?

var_dump($_POST);

exit();

//.... rest or the existing script

?>
```

I think after we get answer to those, we should have a direction to look at.

hanji

----------

## gorkha

The USE flags for apache:

```
USE="apache2 ssl -debug -doc -ldap -mpm-itk -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker (-selinux) -static-modules -threads"
```

php.ini (/etc/php/apache2-php5/php.ini):

```
post_max_size = 8M
```

options for apache:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"
```

Last edited by gorkha on Fri Jun 01, 2007 3:06 am; edited 1 time in total

----------

## gorkha

I cannot dump the $_POST array since any script can't run as soon as I post anything.

----------

## hanj

Anything in the error_log when you try to access the PHP page?

hanji

----------

## gorkha

hmmm yes,

I get a 

```
[notice] Child pid 8817 exit signal Segmentation fault (11)
```

----------

## gorkha

I have also tried emerging apache and php with the emptytree switch, no dice.

----------

## hanj

Can you show me the output of:

```
emerge -pv dev-lang/php
```

That's really strange it's segfaulting on POST.

hanji

----------

## hanj

Also, can you show me your PHP script on the POST side of things. I'm wondering if it's another piece of code that is causing the crash.

Thanks!

hanji

----------

## gorkha

The original script posted to the same page.

But I've now discovered something else - arrays in PHP doesn't seem to work at all

I cannot use print_r, var_dump or is_array without the crash

that is with something as simple as:

```
$test = array();

$test[]= "Test string";

print_r($test);

```

----------

## hanj

Can you please post the output of:

```
emerge -pv dev-lang/php
```

hanji

----------

## ceric35

Exactly the same error here

[notice] child pid 27016 exit signal Segmentation fault (11)

I'm use apache-2.2.4-r4 and php 5.2.2-r1

here is my emerge -pv apache php

```
$ emerge -pv apache php

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] net-www/apache-2.2.4-r4  USE="doc ssl threads -debug -ldap -mpm-event -mpm-itk -mpm-peruser -mpm-prefork -mpm-worker -no-suexec (-selinux) -static-modules" 0 kB

[ebuild   R   ] dev-lang/php-5.2.2-r1  USE="apache2 bzip2 cgi cli crypt ctype gd imap ipv6 mysql nls pcre postgres readline session simplexml ssl threads truetype unicode xml zlib -adabas -bcmath -berkdb -birdstep -calendar -cdb -cjk -concurrentmodphp -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -gdbm -gmp -hash -iconv -inifile -interbase -iodbc -java-external -json -kerberos -ldap -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysqli -ncurses -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -posix -qdbm -recode -reflection -sapdb -sharedext -sharedmem -snmp -soap -sockets -solid -spell -spl -sqlite -suhosin -sybase -sybase-ct -sysvipc -tidy -tokenizer -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip -zip-external" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB
```

This append after upgrade, php script worked well well before, they are not in cause...

EDIT : here is my phpinfo page on my web server, she is not interpreted, and empty : [link removed]

there is too a simple html page [link removed], nothing displayed (i'm sure, it is not empty   :Laughing:  )Last edited by ceric35 on Sun Jun 03, 2007 1:44 pm; edited 1 time in total

----------

## hanj

I bet it's related to cgi USE flag. Try recompiling PHP without that. Also, something tells me you need iconv.. not sure why.. just gut feeling. I believe the problem will be related to cgi though.

hanji

----------

## gorkha

I didn't use the cgi flag when compiling php

```

[ebuild   R   ] dev-lang/php-5.2.2-r1  USE="apache2 bcmath berkdb bzip2 cli crypt ctype curl curlwrappers exif gd gdbm gmp iconv inifile ipv6 java-external* mhash mysql ncurses nls pcre postgres readline reflection session simplexml soap spl ssl tidy tokenizer unicode xml zip zlib -adabas -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -hash -imap -interbase -iodbc -json -kerberos -ldap -ldap-sasl -libedit -mcve -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -posix -qdbm -recode -sapdb -sharedext -sharedmem -snmp -sockets -solid -spell -sqlite -suhosin -sybase -sybase-ct -sysvipc -threads -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip-external (-apache%*)"

```

However I had trouble with the java-external flag. The php-java-bridge didn't compile correctly.Last edited by gorkha on Fri Jun 01, 2007 4:37 pm; edited 1 time in total

----------

## ceric35

same for me, remove the cgi flags didn't help

----------

## hanj

 *gorkha wrote:*   

> I didn't use the cgi flag when compiling php
> 
> ```
> 
> [ebuild   R   ] dev-lang/php-5.2.2-r1  USE="apache2 bcmath berkdb bzip2 cli crypt ctype curl curlwrappers exif gd gdbm gmp iconv inifile ipv6 java-external* mhash mysql ncurses nls pcre postgres readline reflection session simplexml soap spl ssl tidy tokenizer unicode xml zip zlib -adabas -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd-external -hash -imap -interbase -iodbc -json -kerberos -ldap -ldap-sasl -libedit -mcve -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -posix -qdbm -recode -sapdb -sharedext -sharedmem -snmp -sockets -solid -spell -sqlite -suhosin -sybase -sybase-ct -sysvipc -threads -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip-external (-apache%*)"
> ...

 

Do you need java-external? I would recommend stripping PHP down just to see if we can rule out if some of the configure options aren't playing nice with Apache.

Maybe stick with...

apache2 cli crypt ctype curl exif gd gdbm iconv mhash mysql ncurses nls pcre readline session ssl unicode xml zlib

After recompile/restart of apache.. and if it 'works', then start adding your other USE flags one at a time. Is this a recent upgrade or fresh install? I would also suggest rolling back PHP to older ebuild to see if that fixes anything.  We just need to isolate the problem first.

hanji

----------

## ceric35

Found my problem, enabling mod_dav_svn cause apache segfault

----------

## hanj

Ah.. glad you got it. Weird that mod_python would be segfaulting on the POST!!!

hanji

----------

## gorkha

So what use flag do I have to disable?

----------

## ceric35

no, i think your problem is a different one.

In my case, enabling mod_python or mod_dav_svn (witch seam not be compatible with apache 2.2.x)

cause apache segfault for each request (not only php)

Your case seam segfault only in php script, basic html still work...

both apache and php are stable, so, i can't see how to resolve it

what have do you do before it break ?

----------

## gorkha

I have the feeling whatever makes it impossible for me to compile php-java-bridge also causes the segfault somewhere else - even though I have turned java-external off

----------

## gorkha

I've now found out something interesting - I tried to install a package via pecl, but pecl exited with a segfault. So does pear.

----------

## gorkha

I am now down to this:

```
Calculating dependencies... done!

[ebuild   R   ] dev-lang/php-5.2.2-r1  USE="apache2 berkdb bzip2 cli crypt iconv ipv6 mhash ncurses session simplexml unicode xml zip zlib -adabas -bcmath -birdstep -calendar -cdb -cgi -cjk -concurrentmodphp -ctype -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -exif -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gdbm -gmp -hash -imap -inifile -interbase -iodbc -java-external -json -kerberos -ldap -ldap-sasl -libedit -mcve -msql -mssql -mysql -mysqli -nls -oci8 -oci8-instant-client -odbc -pcntl -pcre -pdo -pdo-external -pic -posix -postgres -qdbm -readline -recode -reflection -sapdb -sharedext -sharedmem -snmp -soap -sockets -solid -spell -spl -sqlite -ssl -suhosin -sybase -sybase-ct -sysvipc -threads -tidy -tokenizer -truetype -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip-external" 0 kB

```

and it still has segmentation faults

----------

## beep

Hi,

I just wanna welcome myself on this issue :/

```

The [date] [notice] child pid x exit signal Segmentation fault (11)

```

Is a bitch!

i have 2 web application, one that works without any problem, the other just do seg fault.

Some says its the MPM other the apache temporary files or mod_WhatEver (ldap ftpd etc.)

I have tried change them all sill bitching.

I have try gdb but it wasn't that co-operative,

Minimize the use flags still seg fault.

I'm about to do strace, downgrade PHP, quit my job and start planting flowers.

I need a apache guru are you out there?

best wishes for us all,

::Beppe

----------

## beep

just to let you know downgrade PHP from 5.2.2 to 5.2.1 solved it,

::Beep

----------

## gorkha

Downgrading anything doesn't solve my problem

Now, after updating and removing stuff from the system I now get a segfault when compiling php

```
/var/tmp/portage/dev-lang/php-5.2.2-r1/work/php-5.2.2/TSRM -I/var/tmp/portage/dev-lang/php-5.2.2-r1/work/php-5.2.2/Zend    -I/usr/include -O3 -march=i686 -funroll-loops -pipe  -prefer-non-pic -c /var/tmp/portage/dev-lang/php-5.2.2-r1/work/php-5.2.2/Zend/zend_execute.c -o Zend/zend_execute.lo

/var/tmp/portage/dev-lang/php-5.2.2-r1/work/php-5.2.2/Zend/zend_vm_execute.h: In function `ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER':

/var/tmp/portage/dev-lang/php-5.2.2-r1/work/php-5.2.2/Zend/zend_vm_execute.h:6117: internal compiler error: Segmentation fault

```

----------

## gorkha

I recompiled all packages on my system - php now works  :Smile: 

However, I still can't compile php-java-bridge for some reason

----------

