php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56442 undefined symbol: sapi_get_request_time
Submitted: 2005-07-07 11:40 UTC Modified: 2005-07-07 12:25 UTC
From: a_villacis at palosanto dot com Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: 5.0.3 OS: Linux 2.6.x
Private report: No CVE-ID: None
 [2005-07-07 11:40 UTC] a_villacis at palosanto dot com
Description:
------------
PHP version is actually 5.0.4, but PHP version combo only lists up to 5.0.3
Apache version is 2.0.51 (Fedora Core 2-supplied RPM)
APC version is 3.0.2
Platform is Fedora Core 2, kernel 2.6.10-1.771_FC2, and it has also been confirmed on another Fedora Core 2 system with kernel 2.6.12

PHP configure line is as follows: (php -i | grep configure)
Configure Command =>  './configure' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-dbase=shared' '--with-db4=shared,/usr' '--with-curl=shared' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-pcntl' '--with-mysqli=shared' '--with-mssql=shared' '--enable-soap' '--with-sybase-ct=shared,/usr/local' '--with-readline' '--with-apxs2=/usr/sbin/apxs' '--enable-mbstring'

When installed as instructed (phpize;configure --enable-apc;make;make install), the operation goes "smoothly". However, when the reference to apc.so is added to /usr/local/lib/php.ini and the webserver is restarted, any attempt to execute a PHP script through the web browser fails, and the following is logged in error_log on every attempt:

/usr/sbin/httpd: error while loading shared libraries: /usr/local/lib/php/extensions/no-debug-non-zts-20041030/apc.so: undefined symbol: sapi_get_request_time

This symbol (sapi_get_request_time) does not appear anywhere in the PHP include files installed at /usr/local/include/php/ . Indeed this is an undefined symbol, as evidenced by the compiler warning issued when the -Wall switch is manually added to the compile commmand for php_apc.c or apc_main.c:

[alex@srv64 APC-3.0.2]$ /bin/sh /home/alex/temp/APC-3.0.2/libtool --mode=compile gcc  -I. -I/home/alex/temp/APC-3.0.2 -DPHP_ATOM_INC -I/home/alex/temp/APC-3.0.2/include -I/home/alex/temp/APC-3.0.2/main -I/home/alex/temp/APC-3.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend  -DHAVE_CONFIG_H  -g -O2   -c /home/alex/temp/APC-3.0.2/php_apc.c -o php_apc.lo -Wall
gcc -I. -I/home/alex/temp/APC-3.0.2 -DPHP_ATOM_INC -I/home/alex/temp/APC-3.0.2/include -I/home/alex/temp/APC-3.0.2/main -I/home/alex/temp/APC-3.0.2 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -DHAVE_CONFIG_H -g -O2 -c /home/alex/temp/APC-3.0.2/php_apc.c -Wall  -fPIC -DPIC -o php_apc.lo
/home/alex/temp/APC-3.0.2/php_apc.c: In function `_apc_store':
/home/alex/temp/APC-3.0.2/php_apc.c:373: warning: implicit declaration of function `sapi_get_request_time'
/home/alex/temp/APC-3.0.2/php_apc.c: In function `_apc_define_constants':
/home/alex/temp/APC-3.0.2/php_apc.c:495: warning: dereferencing type-punned pointer will break strict-aliasing rules
[alex@srv64 APC-3.0.2]$


With -Wall, sapi_get_request_time clearly shows as being implicitly defined. By looking into the source files, it seems that there is some versioning check to conditionally use sapi_get_request_time, but this check does not take into account that PHP 5.0.4 (5.0.x ?) lacks this function.

Hope this helps in fixing the issue.


Reproduce code:
---------------
Setup Apache 2.0.51, and PHP 5.0.4, and install APC 5.0.3 as instructed in the INSTALL file.
Add extension=apc.so as instructed in INSTALL file
Try to execute any php file.

Expected result:
----------------
PHP 5.0.4 should load the apc.so extension normally.

Actual result:
--------------
PHP fails to start, and the following appears in the Apache error log:

/usr/sbin/httpd: error while loading shared libraries: /usr/local/lib/php/extensions/no-debug-non-zts-20041030/apc.so: undefined symbol: sapi_get_request_time


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-07 12:04 UTC] rasmus@php.net
Yes, currently APC doesn't support PHP 5.0.x.  Use PHP4 or PHP5.1 for now.  I'll fix this for the next release.
 [2005-07-07 12:25 UTC] rasmus@php.net
Should be fixed with release 3.0.3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 03:01:27 2024 UTC