Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] PHP 5.2.2 + Apache2.058 + MySQL5.0.40 segfault
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Nadie
n00b
n00b


Joined: 29 Oct 2005
Posts: 24

PostPosted: Thu May 24, 2007 12:03 am    Post subject: [SOLVED] PHP 5.2.2 + Apache2.058 + MySQL5.0.40 segfault Reply with quote

Hi there. I'm experiencing segfaults on apache every time one of my websites tries to access any database on the mysql server (for example, SquirreMail). Otherwise, they work just fine. I've already trying rebuilding the apps several times, adding and removing flags on use and make.conf, removing files from php, and some solutions on various posts, downgrading apache, php and mysql, but I couldnt find anything similar, nor a fix.

This is my make.conf:

Code:
CFLAGS="-O3 -march=pentium3 -falign-functions=4 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
# USE FLAGS
USE="-X -nls -v4l -xv -gtk -xmms -xosd -svga -trusted -truetype \
     -truetype-fonts -type1-fonts -motif -wxwindows -wavelan -voodoo3 -pda \
     -pam -oss -opengl -mozilla -kde -qt -gtkhtml -gtk2 -gtk \
     -gphoto2 -gnome -dga -3dfx -3dnow -arts -ipv6 innodb libwww imap \
     maildir sasl ssl vhosts php berkdb -dba mmx cups acpi samba \
     oav pm readline acpi nls apm notcl apache2 mysql xml xml2 unicode \
     openntpd tesseract nptl nls -threads"
PORTDIR_OVERLAY="/usr/local/portage"


package.use:

Code:

net-fs/samba oav readline cups pam libclamav
dev-lang/php -* -fastbuild -force-cgi-redirect -readline -recode
-soap -threads bcmath cli ctype curl dba exif flatfile gd hardenedphp hash iconv libedit jpeg mhash mysql pcre
app-admin/eselect


PHP.INI:
Code:

[PHP]

;
; Enable the PHP scripting language engine under Apache.
engine = On

; Enable compatibility mode with Zend Engine 1 (PHP 4.x)
zend.ze1_compatibility_mode = Off

short_open_tag = On

; Allow ASP-style <% %> tags.
asp_tags = Off

; The number of significant digits displayed in floating point numbers.
precision    =  12

; Enforce year 2000 compliance (will cause problems with non-compliant browsers)
y2k_compliance = On


output_buffering = Off


zlib.output_compression = Off
;zlib.output_compression_level = -1

;zlib.output_handler =

implicit_flush = Off

unserialize_callback_func=

serialize_precision = 100

allow_call_time_pass_reference = On

;
; Safe Mode
;
safe_mode = Off

safe_mode_gid = Off

safe_mode_include_dir =

safe_mode_exec_dir =

;open_basedir =

disable_functions =

disable_classes =

; realpath_cache_ttl=120

error_reporting  =  E_ALL & ~E_NOTICE

display_startup_errors = Off

log_errors = Off

log_errors_max_len = 1024

ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On

;report_zend_debug = 0


track_errors = Off
;html_errors = Off
variables_order = "EGPCS"
register_globals = Off

register_long_arrays = On

register_argc_argv = On

auto_globals_jit = On


post_max_size = 8M
default_mimetype = "text/html"
;default_charset = "iso-8859-1"
include_path = ".:/usr/share/php5:/usr/share/php"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
user_dir =
extension_dir = /usr/lib/php5/lib/php/extensions/no-debug-non-zts-20060613
enable_dl = On

file_uploads = On

default_socket_timeout = 60
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1
mysql.default_port =

mysql.default_socket =

mysql.default_host =

mysql.default_user =
mysql.default_password =


mysql.trace_mode = Off

[MySQLi]
mysqli.max_links = -1

mysqli.default_port = 3306

mysqli.default_socket =


mysqli.default_host =
mysqli.default_user =

mysqli.reconnect = Off


[Session]

session.save_handler = files
session.use_cookies = 1

;session.cookie_secure =

session.name = PHPSESSID


session.auto_start = 0

[Assertion]
; MySQL extensions default connection charset settings
;mysql.connect_charset = utf8
;mysqli.connect_charset = utf8
;pdo_mysql.connect_charset = utf8


httpd.conf:

Code:

ServerRoot "/usr/lib/apache2"

#LockFile "/var/run/apache2.lock"
PidFile "/var/run/apache2.pid"

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule worker.c>
    StartServers         2
    MaxClients         150
    MinSpareThreads     25
    MaxSpareThreads     75
    ThreadsPerChild     25
    MaxRequestsPerChild  0
</IfModule>
LoadModule access_module                 modules/mod_access.so
LoadModule auth_module                   modules/mod_auth.so
LoadModule auth_anon_module              modules/mod_auth_anon.so
LoadModule auth_dbm_module               modules/mod_auth_dbm.so
LoadModule auth_digest_module            modules/mod_auth_digest.so
LoadModule charset_lite_module           modules/mod_charset_lite.so
LoadModule env_module                    modules/mod_env.so
LoadModule expires_module                modules/mod_expires.so
LoadModule headers_module                modules/mod_headers.so
LoadModule mime_module                   modules/mod_mime.so
LoadModule negotiation_module            modules/mod_negotiation.so
LoadModule setenvif_module               modules/mod_setenvif.so
LoadModule log_config_module             modules/mod_log_config.so
LoadModule logio_module                  modules/mod_logio.so

LoadModule cgi_module                    modules/mod_cgi.so
LoadModule cgid_module                   modules/mod_cgid.so

LoadModule suexec_module                 modules/mod_suexec.so

LoadModule alias_module                  modules/mod_alias.so
LoadModule rewrite_module                modules/mod_rewrite.so
<IfDefine USERDIR>
    LoadModule userdir_module            modules/mod_userdir.so
</IfDefine>
<IfDefine INFO>
    LoadModule info_module               modules/mod_info.so
    LoadModule status_module             modules/mod_status.so
</IfDefine>
LoadModule actions_module                modules/mod_actions.so
LoadModule autoindex_module              modules/mod_autoindex.so
LoadModule dir_module                    modules/mod_dir.so

LoadModule ext_filter_module             modules/mod_ext_filter.so
LoadModule deflate_module                modules/mod_deflate.so
LoadModule include_module                modules/mod_include.so

<IfDefine PROXY>
    LoadModule proxy_module                  modules/mod_proxy.so
    LoadModule proxy_connect_module          modules/mod_proxy_connect.so
    LoadModule proxy_ftp_module              modules/mod_proxy_ftp.so
    LoadModule proxy_http_module             modules/mod_proxy_http.so
</IfDefine>
Include /etc/apache2/modules.d/*.conf


So...any ideas? Thanks a lot in advance


Last edited by Nadie on Wed May 30, 2007 2:24 am; edited 1 time in total
Back to top
View user's profile Send private message
AllenJB
Veteran
Veteran


Joined: 02 Sep 2005
Posts: 1285

PostPosted: Thu May 24, 2007 7:22 am    Post subject: Reply with quote

My first port of call would be to run "revdep-rebuild". Since the problem is specific to accessing the MySQL databases, by guess would be that this is where the problem lies.

What happens is that mysql provides a library which other applications then use to talk to it. However, if MySQL is upgraded and the library changes significantly, it will start causing problems unless the programs that use the library are recompiled to work with the new version. revdep-rebuild basically goes through the installed packages, checking what libraries they use, and if it thinks they need it, lists them for recompiling.

Tip: You can use "revdep-rebuild -p" to have revdep-rebuild tell you what it will do instead of actually doing it.
Back to top
View user's profile Send private message
Nadie
n00b
n00b


Joined: 29 Oct 2005
Posts: 24

PostPosted: Thu May 24, 2007 11:21 am    Post subject: Reply with quote

AllenJB wrote:
My first port of call would be to run "revdep-rebuild". Since the problem is specific to accessing the MySQL databases, by guess would be that this is where the problem lies.

What happens is that mysql provides a library which other applications then use to talk to it. However, if MySQL is upgraded and the library changes significantly, it will start causing problems unless the programs that use the library are recompiled to work with the new version. revdep-rebuild basically goes through the installed packages, checking what libraries they use, and if it thinks they need it, lists them for recompiling.

Tip: You can use "revdep-rebuild -p" to have revdep-rebuild tell you what it will do instead of actually doing it.


Thanks for your answer! Already done it.Other than finding missing libraries for X (wich I dont use), it doesnt recompile anything related with MySQL, PHP nor apache.
Back to top
View user's profile Send private message
Nadie
n00b
n00b


Joined: 29 Oct 2005
Posts: 24

PostPosted: Fri May 25, 2007 9:11 pm    Post subject: Reply with quote

Bump. Any toughts? Just tried unmerging/reemerging Mysql...no luck.
Back to top
View user's profile Send private message
Dave_Lindquist
Apprentice
Apprentice


Joined: 15 Mar 2004
Posts: 160

PostPosted: Mon May 28, 2007 3:23 pm    Post subject: Reply with quote

If this is the same thing I'm having, it's entirely PHP.

The behaviour I'm seeing (after upgrading to 5.2) is:
- Any PHP script that contains a <?php tag of any kind segfaults the apache child process
- Any PHP script that contains ONLY html (no <?php tag) works fine.

I can do this with the most simple, brain-dead script, and it still causes the problem.

And (dammit!), PHP 5.1 is now on the security advisory list.... Sigh....

No-one has seen any solutions?
Back to top
View user's profile Send private message
Dave_Lindquist
Apprentice
Apprentice


Joined: 15 Mar 2004
Posts: 160

PostPosted: Mon May 28, 2007 5:49 pm    Post subject: Reply with quote

SOLVED!

After much digging, I managed to find references to bad CFLAGS causing this problem.

Apparently "-funroll-loops" in your CFLAGS will cause this.

Specifically, I removed:
Code:
-funroll-loops -mmmx -m3dnow

from my CFLAGS, and the problem no longer seems to occur!
Back to top
View user's profile Send private message
Nadie
n00b
n00b


Joined: 29 Oct 2005
Posts: 24

PostPosted: Tue May 29, 2007 9:42 pm    Post subject: Reply with quote

Doesnt work for me. those are my CFLAGS:

Code:
USE="-X  -v4l -xv -gtk -xmms -xosd -svga -trusted -truetype \
     -truetype-fonts -type1-fonts -motif -wxwindows -wavelan -voodoo3 -pda \
     -pam -oss -opengl -mozilla -kde -qt -gtkhtml -gtk2 -gtk \
     -gphoto2 -gnome -dga -3dfx -3dnow -arts -ipv6 libwww imap \
     maildir sasl ssl vhosts php berkdb mmx cups acpi samba \
     oav pm readline acpi -nls apm php apache2 mysql xml xml2 unicode \
     openntpd tesseract nptl nptonly funroll-loops"


and this my packege.use

Quote:

dev-lang/php -* apache2 berkdb calendar doc imap mysql readline session xml soc$
dev-db/mysql berkdb ssl -big-tables -cluster -debug -embedded -extraengine -la$
Back to top
View user's profile Send private message
Nadie
n00b
n00b


Joined: 29 Oct 2005
Posts: 24

PostPosted: Wed May 30, 2007 2:20 am    Post subject: Reply with quote

Solved! Added O2 and removed -funroll-loops from cflags. Thank you all for your support.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum