|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22215 PHP dies while loading php.ini
Submitted: 2003-02-13 16:14 UTC Modified: 2003-10-07 16:47 UTC
From: phpbug-130203-2 at smayw dot nask dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4CVS-2003-02-13 (stable) / 5CVS-2003-02-13 (dev) OS: *
Private report: No CVE-ID: None
 [2003-02-13 16:14 UTC] phpbug-130203-2 at smayw dot nask dot com
current (Thu Feb 13 22:00:53 GMT 2003) php-4.3 from CVS compiled as follows:

./configure  --disable-ipv6 --with-config-file-path=/etc/httpd/conf --enable-memory-limit --disable-display-source --enable-track-var --with-imap --with-imap-ssl --with-apxs=/usr/local/apache/current/bin/apxs --with-gd=/usr --with-jpeg-dir=/usr --with-xpm-dir=/usr/X11R6 --with-mysql=/usr/local/mysql/current --with-curl --enable-ftp --enable-dbase --enable-xml --with-xml --with-gettext --with-mcrypt --disable-posix

prevents Apache-1.3.27 from starting (segfault).  strace on the CLI SAPI shows a problem accessing php.ini:

close(3)                                = 0
brk(0x822c000)                          = 0x822c000
open("sapi/cli//php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/httpd/conf/php-cli.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
open("sapi/cli//php.ini", O_RDONLY)     = -1 ENOENT (No such file or directory)
open("/etc/httpd/conf/php.ini", O_RDONLY) = 3
getcwd("/usr/local/src/php-cvs/php4", 4095) = 28
lstat64("/etc", {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
lstat64("/etc/httpd", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/etc/httpd/conf", {st_mode=S_IFDIR|0771, st_size=4096, ...}) = 0
lstat64("/etc/httpd/conf/php.ini", {st_mode=S_IFREG|0644, st_size=331, ...}) = 0
brk(0x8231000)                          = 0x8231000
ioctl(3, 0x5401, 0xbfffca80)            = -1 ENOTTY (Inappropriate ioctl for device)
fstat64(3, {st_mode=S_IFREG|0644, st_size=331, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40018000
read(3, "register_globals = on\nignore_use"..., 8192) = 331
read(3, "", 4096)                       = 0
read(3, "", 8192)                       = 0
ioctl(3, 0x5401, 0xbfffbed0)            = -1 ENOTTY (Inappropriate ioctl for device)
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

The exact same config works fine with plain 4.3 tarball compile.

The system is RedHat 7.2 with autoconf/automake/libtool upgraded to play nice with PHP/CVS.

The /etc/httpd/conf/php.ini file is as follows:

register_globals = on
ignore_user_abort = on
log_errors = true
#zend_optimizer.optimization_level = 15
#zend_extension = "/usr/local/lib/"
display_errors = false
memory_limit = 655360000
post_max_size = 655360000
upload_max_filesize = 327680000
upload_tmp_dir  = /var/tmp
max_input_time = 60
max_execution_time = 30

If I can help with any further details please let me know.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-13 16:19 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Also, do you have the 'auto_detect_line_endings' enabled in your ini file?
 [2003-02-14 02:08 UTC] phpbug-130203-2 at smayw dot nask dot com
I do _not_ have auto_detect_line_endings enabled in my ini file.  The contents of the file are included in my original report.  Backtrace follows - perhaps this should be a 'scripting engine problem' if it is a PHP problem.

(gdb) run
Starting program: /usr/local/src/php-cvs/php4/sapi/cli/php 

Program received signal SIGSEGV, Segmentation fault.
0x404044fc in memcpy () at memcpy:-1
-1      memcpy: No such file or directory.
        in memcpy
(gdb) bt
#0  0x404044fc in memcpy () at memcpy:-1
#1  0xdfffdea5 in ?? ()
#2  0x081258e3 in zend_parse_ini_file (fh=0xbfffd9e0, unbuffered_errors=1, 
    ini_parser_cb=0x8112948 <php_config_ini_parser_cb>, arg=0x821f900)
    at /usr/local/src/php-cvs/php4/Zend/zend_ini_parser.y:164
#3  0x08112e99 in php_init_config () at /usr/local/src/php-cvs/php4/main/php_ini.c:386
#4  0x0810ee9f in php_module_startup (sf=0x821c720, additional_modules=0x0, num_additional_modules=0)
    at /usr/local/src/php-cvs/php4/main/main.c:1104
#5  0x081504c1 in main (argc=1, argv=0xbfffdc84) at /usr/local/src/php-cvs/php4/sapi/cli/php_cli.c:481
#6  0x40397657 in __libc_start_main (main=0x8150398 <main>, argc=1, ubp_av=0xbfffdc84, init=0x806a8e4 <_init>, 
    fini=0x81a0760 <_fini>, rtld_fini=0x4000dcd4 <_dl_fini>, stack_end=0xbfffdc7c)
    at ../sysdeps/generic/libc-start.c:129
 [2003-02-14 13:27 UTC]
This bug appears to be yet another bison oddity.
I managed to reproduce with bison 1.875a

Which version of bison are you using?

$ bison --version

 [2003-02-14 13:31 UTC]
Sorry, I forgot that I live in a far east area.
Correcting version info.

 [2003-02-14 14:50 UTC] phpbug-130203-2 at smayw dot nask dot com
not quite 1.875a, but close

$ bison --version                                                                                 bison (GNU Bison) 1.875
 [2003-02-14 16:47 UTC]
That version is know to cause the crash in PHP. Please downgrade to 1.75 or all the way down to 1.28.
 [2003-02-14 17:00 UTC] phpbug-130203-2 at smayw dot nask dot com
This should make it into for others to know, unless the PHP/Zend team is planning a workaround.  The page now says "bison (1.28+)"

 [2003-02-18 11:44 UTC]
Then let's wait for a new bison release that solves this issue.

 [2003-02-18 11:51 UTC]
Using the old bison 1.28 fixes this. And it's not really
PHP bug. 

 [2003-10-04 17:17 UTC] azarah at gentoo dot org
Problem is that zend_ini_open_file_for_scanning() do not
set yyin to the correct handle.  Below patch is for latest
php5 cvs.

We have an similar issue with php-4.3.3, although a different
patch will be needed, as things have changed slightly.


--- php5/Zend/zend_ini_scanner.l        2003-10-04 22:33:28.198665760 +0200
+++     2003-10-04 22:35:00.317661544 +0200
@@ -76,7 +76,13 @@ int zend_ini_open_file_for_scanning(zend
-       yyin = fh;
+       switch (fh->type) {
+               case ZEND_HANDLE_FP:
+                       yyin = fh->handle.fp;
+               break;
+       }
        yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE TSRMLS_CC) TSRMLS_CC);
        ini_filename = fh->filename;
        return SUCCESS;
 [2003-10-05 13:08 UTC] azarah at gentoo dot org
Note that for NLS (or multibyte) input this patch do not
 [2003-10-06 01:33 UTC]
The patch doesn't look right:
Zend/zend_ini_scanner.l: In function `zend_ini_open_file_for_scanning':
Zend/zend_ini_scanner.l:82: warning: assignment from incompatible pointer type
 [2003-10-07 16:47 UTC]
Finally fixed in cvs.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 08 00:05:48 2023 UTC