php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52419 Unable to compile PHP with both Apache2 and FPM support
Submitted: 2010-07-23 18:19 UTC Modified: 2010-12-20 12:56 UTC
Votes:13
Avg. Score:4.2 ± 0.8
Reproduced:11 of 12 (91.7%)
Same Version:10 (90.9%)
Same OS:4 (36.4%)
From: php-bugs at majkl578 dot cz Assigned: jani (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.3.3 OS: Linux Debian
Private report: No CVE-ID: None
 [2010-07-23 18:19 UTC] php-bugs at majkl578 dot cz
Description:
------------
PHP fails to compile with both Apache 2 module (option --with-apxs2) and FPM enabled (option --enable-fpm).

Test script:
---------------
Configure line:
./configure --prefix=/usr --sysconfdir=/etc --cache-file=./config.cache --with-config-file-path=/etc/php --with-config-file-scan-dir=/etc/php/extensions --enable-bcmath=shared --with-bz2=shared --enable-calendar=shared --with-curl=shared --enable-exif=shared --enable-ftp=shared --with-gd --with-gettext=shared --with-gmp --with-imap=shared --with-imap-ssl --with-kerberos --with-ldap=shared --enable-mbstring=shared --with-mcrypt=shared --with-mhash=shared --without-mssql --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-openssl --enable-pcntl=shared --enable-pdo=shared -with-pdo-mysql=shared --with-pdo-sqlite=shared --without-pgsql --with-pspell=shared --with-snmp=shared --with-sqlite=shared --with-sqlite3=shared --enable-sqlite-utf8 --enable-soap=shared --enable-sockets=shared --without-sybase-ct --enable-sysvmsg=shared --enable-sysvsem=shared --enable-sysvshm=shared --with-tidy=shared --without-unixODBC --with-xmlrpc=shared --with-xsl=shared --enable-zip=shared --with-zlib=shared --disable-short-tags --enable-debug --enable-cgi --enable-cli --with-pear --enable-zend-multibyte --with-apxs2=/usr/bin/apxs2 --enable-fpm

Actual result:
--------------
$ make -j 2
blahblahblah
Generating phar.php
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_ub_write':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:84: undefined reference to `ap_rwrite'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_header_handler':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:101: undefined reference to `apr_table_unset'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:105: undefined reference to `apr_table_clear'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:136: undefined reference to `ap_set_content_length'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:139: undefined reference to `apr_table_set'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:141: undefined reference to `apr_table_add'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_send_headers':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:164: undefined reference to `apr_pstrdup'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:167: undefined reference to `apr_table_set'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:176: undefined reference to `apr_pstrdup'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:176: undefined reference to `ap_set_content_type'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_read_post':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:202: undefined reference to `apr_brigade_flatten'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:203: undefined reference to `apr_brigade_cleanup'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:201: undefined reference to `ap_get_brigade'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_read_cookies':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:246: undefined reference to `apr_table_get'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_getenv':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:262: undefined reference to `apr_table_get'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_register_variables':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:271: undefined reference to `apr_table_elts'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_flush':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:311: undefined reference to `ap_rflush'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_log_message':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:324: undefined reference to `ap_log_error'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:326: undefined reference to `ap_log_rerror'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_sapi_log_message_ex':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:333: undefined reference to `ap_log_rerror'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_add_version':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:410: undefined reference to `ap_add_version_component'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_pre_config':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:419: undefined reference to `ap_mpm_query'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:421: undefined reference to `ap_log_error'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_server_startup':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:439: undefined reference to `apr_pool_userdata_get'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:446: undefined reference to `apr_pool_cleanup_null'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:446: undefined reference to `apr_pool_userdata_set'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:459: undefined reference to `apr_pool_cleanup_null'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:459: undefined reference to `apr_pool_cleanup_register'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_request_ctor':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:478: undefined reference to `apr_table_get'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:479: undefined reference to `apr_pstrdup'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:482: undefined reference to `apr_pstrdup'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:483: undefined reference to `apr_pstrdup'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:486: undefined reference to `apr_table_get'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:489: undefined reference to `apr_table_unset'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:490: undefined reference to `apr_table_unset'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:491: undefined reference to `apr_table_unset'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:492: undefined reference to `apr_table_unset'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:493: undefined reference to `ap_auth_type'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:494: undefined reference to `apr_table_get'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:499: undefined reference to `apr_pstrdup'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_ini_dtor':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:534: undefined reference to `apr_pool_cleanup_run'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_handler':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:556: undefined reference to `apr_palloc'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:561: undefined reference to `apr_pool_cleanup_null'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:561: undefined reference to `apr_pool_cleanup_register'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:609: undefined reference to `ap_add_common_vars'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:610: undefined reference to `ap_add_cgi_vars'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:616: undefined reference to `apr_brigade_create'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:651: undefined reference to `ap_update_mtime'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:652: undefined reference to `ap_set_last_modified'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:675: undefined reference to `apr_psprintf'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:674: undefined reference to `apr_table_set'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:683: undefined reference to `apr_bucket_eos_create'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:686: undefined reference to `ap_pass_brigade'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:692: undefined reference to `apr_brigade_cleanup'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_apache_child_init':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:702: undefined reference to `apr_pool_cleanup_null'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:702: undefined reference to `apr_pool_cleanup_register'
sapi/apache2handler/.libs/sapi_apache2.o: In function `php_ap2_register_hook':
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:707: undefined reference to `ap_hook_pre_config'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:708: undefined reference to `ap_hook_post_config'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:709: undefined reference to `ap_hook_handler'
/storage/php/php-5.3.3/sapi/apache2handler/sapi_apache2.c:710: undefined reference to `ap_hook_child_init'
sapi/apache2handler/.libs/apache_config.o: In function `real_value_hnd':
/storage/php/php-5.3.3/sapi/apache2handler/apache_config.c:68: undefined reference to `apr_pstrdup'
sapi/apache2handler/.libs/apache_config.o: In function `php_apache_phpini_set':
/storage/php/php-5.3.3/sapi/apache2handler/apache_config.c:116: undefined reference to `ap_server_root_relative'
sapi/apache2handler/.libs/apache_config.o: In function `create_php_config':
/storage/php/php-5.3.3/sapi/apache2handler/apache_config.c:225: undefined reference to `apr_palloc'
/storage/php/php-5.3.3/sapi/apache2handler/apache_config.c:229: undefined reference to `apr_pool_cleanup_null'
/storage/php/php-5.3.3/sapi/apache2handler/apache_config.c:229: undefined reference to `apr_pool_cleanup_register'
sapi/apache2handler/.libs/php_functions.o: In function `php_apache_lookup_uri':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:67: undefined reference to `ap_sub_req_lookup_uri'
sapi/apache2handler/.libs/php_functions.o: In function `zif_virtual':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:89: undefined reference to `ap_destroy_sub_req'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:99: undefined reference to `ap_rflush'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:101: undefined reference to `ap_run_sub_req'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:103: undefined reference to `ap_destroy_sub_req'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:106: undefined reference to `ap_destroy_sub_req'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_lookup_uri':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:162: undefined reference to `ap_destroy_sub_req'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:167: undefined reference to `ap_destroy_sub_req'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_request_headers':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:186: undefined reference to `apr_table_elts'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_response_headers':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:210: undefined reference to `apr_table_elts'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_note':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:234: undefined reference to `apr_table_get'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:237: undefined reference to `apr_table_set'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_setenv':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:277: undefined reference to `apr_table_set'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_getenv':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:313: undefined reference to `apr_table_get'
sapi/apache2handler/.libs/php_functions.o: In function `php_apache_get_version':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:328: undefined reference to `ap_get_server_version'
sapi/apache2handler/.libs/php_functions.o: In function `zif_apache_get_modules':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:356: undefined reference to `ap_loaded_modules'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:355: undefined reference to `ap_loaded_modules'
sapi/apache2handler/.libs/php_functions.o: In function `zm_info_apache':
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:383: undefined reference to `ap_loaded_modules'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:382: undefined reference to `ap_loaded_modules'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:413: undefined reference to `unixd_config'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:413: undefined reference to `unixd_config'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:413: undefined reference to `unixd_config'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:418: undefined reference to `ap_mpm_query'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:422: undefined reference to `apr_snprintf'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:428: undefined reference to `ap_server_root'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:437: undefined reference to `apr_table_elts'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:457: undefined reference to `apr_table_elts'
/storage/php/php-5.3.3/sapi/apache2handler/php_functions.c:466: undefined reference to `apr_table_elts'
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1
make: *** Waiting for unfinished jobs....

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-23 18:40 UTC] rasmus@php.net
hrm, it builds perfectly fine on my Debian box with your exact configure line.  
Are you sure your libapr package is installed correctly?  Try a make clean and 
reinstall your libapr.
 [2010-07-23 19:35 UTC] php-bugs at majkl578 dot cz
I've reinstalled libapr and libapr-dev, make clean'ed, then reconfigured and re-run compilation. Exactly same error.
Compiling them separately works fine.

Versions:
apache2: 2.2.15-6
libapr and libapr-dev: 1.4.2-3
 [2010-07-23 19:38 UTC] rasmus@php.net
Do you have access to another Debian box somewhere?  Or perhaps a clean VM?  A lot 
of the PHP developers are on Debian, myself included, so it would really surprise 
me if there was a general compile issue there.  And since I can't reproduce it 
with your exact configure line, there is something about your environment that is 
different.
 [2010-07-23 20:39 UTC] php-bugs at majkl578 dot cz
No, I don't, I've only this one. Maybe it's really (somehow) related to my environment, because I'm also unable to compile PHP with pecl binary even if '--with-pear' and '--enable-cli' are set...
 [2010-07-23 20:44 UTC] rasmus@php.net
You could try it in a clean Debian image using the free vmware player and the 
images from http://www.thoughtpolice.co.uk/vmware/
Just so you have a clean environment to compare yours against.
 [2010-08-04 10:35 UTC] ali at aliziad dot clom
fyi:

I am also getting the same error with php 5.3.3 (/w apxs and fpm) on CentOS

-ali
 [2010-09-01 12:05 UTC] fat@php.net
I have a similar issue with the current PHP_5_3.

When the php-fpm is built, it's linked against :

sapi/apache2handler/mod_php5.lo
sapi/apache2handler/sapi_apache2.lo
sapi/apache2handler/apache_config.lo
sapi/apache2handler/php_functions.lo

I think it's somehow related to http://bugs.php.net/52498.
 [2010-09-01 14:29 UTC] fat@php.net
The problem is:

in the general Makefile there is:

BUILD_FPM = $(LIBTOOL) --mode=link $(CC) -export-dynamic $(CFLAGS_CLEAN) 
$(EXTRA_CFLAGS) $(EXTRA_LDFLAGS_PROGRAM) $(LDFLAGS) $(PHP_RPATHS) 
$(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(SAPI_EXTRA_LIBS) 
$(ZEND_EXTRA_LIBS) -o $(SAPI_FPM_PATH)

and 

PHP_SAPI_OBJS = sapi/apache2handler/mod_php5.lo 
sapi/apache2handler/sapi_apache2.lo sapi/apache2handler/apache_config.lo 
sapi/apache2handler/php_functions.lo sapi/fpm/fpm/fastcgi.lo sapi/fpm/fpm/fpm.lo 
sapi/fpm/fpm/fpm_children.lo sapi/fpm/fpm/fpm_cleanup.lo 
sapi/fpm/fpm/fpm_clock.lo sapi/fpm/fpm/fpm_conf.lo sapi/fpm/fpm/fpm_env.lo 
sapi/fpm/fpm/fpm_events.lo sapi/fpm/fpm/fpm_main.lo sapi/fpm/fpm/fpm_php.lo 
sapi/fpm/fpm/fpm_php_trace.lo sapi/fpm/fpm/fpm_process_ctl.lo 
sapi/fpm/fpm/fpm_request.lo sapi/fpm/fpm/fpm_shm.lo 
sapi/fpm/fpm/fpm_shm_slots.lo sapi/fpm/fpm/fpm_signals.lo 
sapi/fpm/fpm/fpm_sockets.lo sapi/fpm/fpm/fpm_status.lo sapi/fpm/fpm/fpm_stdio.lo 
sapi/fpm/fpm/fpm_unix.lo sapi/fpm/fpm/fpm_worker_pool.lo sapi/fpm/fpm/zlog.lo 
sapi/fpm/fpm/fpm_trace.lo sapi/fpm/fpm/fpm_trace_ptrace.lo 
main/internal_functions.lo

FPM is linked with apache but the apr lib is not known at compile time.

There is the same problem when compiling libphp5.so which is linked agains FPM 
object files and libevent is not known at compile time:

# make libs/libphp5.bundle

sapi/fpm/fpm/fpm_children.o: In function `fpm_children_make':
/LIBRE/dev/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_children.c:381: undefined 
reference to `event_reinit'
 [2010-09-01 17:42 UTC] fat@php.net
the problem is the same if compiling SAPI apache2handler with litespeed. The same 
with fpm and litespeed.

Is it possible to compile PHP with multiple SAPI ?
 [2010-09-02 12:22 UTC] james dot butler at sandfox dot co dot uk
I can confirm this is an issue on Centos 5.5 64bit
get exactly the same error when trying to compile with apxs AND fpm both enabled.
Removing either one from the config line results in successful compilation.
 [2010-09-02 12:25 UTC] pajoye@php.net
@fat@php.net

Yes, as long as they are all zts (x)or non thread safe.
 [2010-09-04 11:07 UTC] m dot ghadam at gmail dot com
I get the same error when tried to compile httpd with both --with-apxs2 and --enable-fpm option.
OS : CentOS 5.5 i686
Removing one of them results successfull compilation.
 [2010-09-04 14:38 UTC] hengjie at gmail dot com
Yes, I get exactly the same issue with CentOS 5.5 64bit.
 [2010-11-14 00:14 UTC] jani@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: jani
 [2010-11-14 00:14 UTC] jani@php.net
Fixed in trunk. Now it's possible to build all binary SAPIs (CGI, FPM, CLI, etc) and one SAPI module like Apache.
 [2010-11-18 18:40 UTC] baldzius at gmail dot com
When can we expect this fix to be merged in 5.3? Thanks.
 [2010-11-18 21:55 UTC] jani@php.net
It is a feature not bug fix so never. In next 5.x release though. I might partially merge the configure error when trying to build multiple SAPIs the same time..
 [2010-11-19 09:26 UTC] jani@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=305553
Log: - Merged check from trunk to prevent building multiple SAPIs (bug #52419)
 [2010-12-20 12:56 UTC] jani@php.net
-Package: Tidy +Package: Compile Failure
 [2015-02-23 19:51 UTC] alanivey at gmail dot com
It's not thoroughly tested yet, but I back-ported this to PHP 5.3.29: https://gist.github.com/alanthing/3bd0334a5dabd4b769e3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC