Fedora Linux Support Community & Resources Center
Old 24th July 2012, 09:20 PM
darkfiz Offline
Registered User
Join Date: Jul 2012
Location: France
Posts: 2
Build PHP RPM - apxs error

Hi All,

I'm used to compile / make / make install my own Apache and Php Distributions from the
tarball. Now i want to move to RPM format and be able to deploy my own RPM.
I have already build a RPM for Apache from the sources and get it installed in my own
custom RPM database. Custom database is created in this way :
* rpm --initdb --dbpath $HOME/rpmdatabase

Now i want to build PHP from the tarball. There is two to perform such action :
  • PHP is call throught Apache Fast CGI/FPM
  • PHP is Load as an Apache Module

I'm blocking on the second case : PHP as an Apache Module

Please find the error, i'm facing :

Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.5M37PW
+ umask 022
+ cd /home/esedev12/rpmbuild/BUILD
+ cd php-5.2.17
+ rm -Rf /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64
+ make install INSTALL_ROOT=/home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64
Installing PHP SAPI module: apache2handler
/home/esedev12/base_apache/httpd-2.2.22_depl/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' libphp5.la /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64/home/esedev12/base_apache/httpd-2.2.22_depl/modules
/usr/lib64/apr-1/build/libtool --mode=install cp libphp5.la /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64/home/esedev12/base_apache/httpd-2.2.22_depl/modules/
libtool: install: cp .libs/libphp5.so /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64/home/esedev12/base_apache/httpd-2.2.22_depl/modules/libphp5.so
libtool: install: cp .libs/libphp5.lai /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64/home/esedev12/base_apache/httpd-2.2.22_depl/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/esedev12/rpmbuild/BUILD/php-5.2.17/libs'
chmod 755 /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64/home/esedev12/base_apache/httpd-2.2.22_depl/modules/libphp5.so
apxs:Error: Config file /home/esedev12/rpmbuild/BUILDROOT/php-5.2-17.x86_64/home/esedev12/base_apache/httpd-2.2.22_depl/conf/httpd.conf not found.
make: *** [install-sapi] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.5M37PW (%install)
Please find my spec file for PHP :

%define _mytopdir /home/esedev12
%define _topdir %{_mytopdir}/rpmbuild
%define _prefix %{_mytopdir}/base_php/php-5.2.17_depl
%define _bindir %{_prefix}/bin
%define _sysconfdir %{_prefix}/etc
%define _includedir %{_prefix}/include
%define _libexecdir %{_prefix}/modules
%define _mandir %{_prefix}/man
%define _apachetopdir %{_mytopdir}/apache
%define _apacheversion 2.2.22
%define _apxs %{_apachetopdir}/bin/apxs

%define name php
%define release 17
%define version 5.2

Name: %{name}
Version: %{version}
Release: %{release}
Summary: Societe Generale PHP scripting language for creating dynamic web sites
Group: Development/Languages
Source0: %{name}-%{version}.%{release}.tar.gz
Patch0: php-5.2.17_configure.patch
License: PHP
URL: http://www.php.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: httpd
#= %{_apacheversion}
Requires(pre): httpd
#= %{_apacheversion}

PHP is an HTML-embedded scripting language. PHP attempts to make it
easy for developers to write dynamically generated web pages. PHP also
offers built-in database integration for several commercial and
non-commercial database management systems, so writing a
database-enabled webpage with PHP is fairly simple. The most common
use of PHP coding is probably as a replacement for CGI scripts.

The php package contains the module which adds support for the PHP
language to Apache HTTP Server.

%setup -q -n %{name}-%{version}.%{release}
%patch0 -p1 -b .apxs

export SYSCONFDIR="/home/esedev12/apache/conf"
export LIBEXECDIR="/home/esedev12/apache/modules"

%configure \
--quiet \
--prefix=%{_prefix} \
--with-apxs2=%{_apxs} \
%ifarch %{ix86} x86_64
--with-libdir=lib64 \
--with-libdir=lib \
--disable-all \
--disable-ipv6 \
--enable-bcmath \
--enable-calendar \
--enable-ctype \
--enable-debug \
--enable-dom \
--enable-filter \
--enable-fileinfo \
--enable-ftp \
--enable-hash \
--enable-libxml \
--enable-pdo \
--enable-posix \
--enable-soap \
--enable-xml \
--enable-session \
--with-curl \
--with-iconv \
--with-ldap \
--with-openssl \
--with-pcre-regex \
--with-pdo-sqlite \
--with-pear \
--with-sqlite \
--with-sqlite3 \
--with-xsl \

make %{?_smp_mflags} EXTRA_CFLAGS="-Werror-implicit-function-declaration"

rm -Rf %{buildroot}


%dir %{_bindir}

%dir %{_sysconfdir}



%dir %{_mandir}
%dir %{_mandir}/man1


%defattr (750,esedev12,esedev)
%dir /.channels
%dir /.channels/.alias

%defattr (640,esedev12,esedev)
Idea is to first having a PHP RPM. After every extension will be split into subpackage.
I'm currently blocked on the error. I'm building the RPM package in this way :

rpmbuild -ba -vv --dbpath $HOME/rpmdatabase php-5.2.17.spec

If you need Apache Spec file, i will provide it

Many thanks for all your help.


Reply With Quote
Old 24th July 2012, 11:40 PM
Posts: n/a
Re: Build PHP RPM - apxs error

BuildRequires: httpd

should be

BuildRequires: httpd-devel

You probably have other missing deps, check here for list


Last edited by Yellowman; 24th July 2012 at 11:44 PM.
Reply With Quote
Old 25th July 2012, 08:14 AM
darkfiz Offline
Registered User
Join Date: Jul 2012
Location: France
Posts: 2
Re: Build PHP RPM - apxs error


Apache is also a custom RPM with no sub packages. Please find the content of the SPEC file :
%define _topdir /home/esedev12/rpmbuild
%define _prefix /home/esedev12/base_apache/httpd-2.2.22_depl
%define _bindir %{_prefix}/bin
%define _sysconfdir %{_prefix}/conf
%define _sbindir %{_prefix}/build
%define _includedir %{_prefix}/include
%define _libexecdir %{_prefix}/modules
%define _mandir %{_prefix}/man

%define name httpd
%define release 22
%define version 2.2

Name: %{name}
Version: %{version}
Release: %{release}
Summary: Societe Generale Apache Httpd Package
Group: System Environment/Daemons
Source0: %{name}-%{version}.%{release}.tar.gz
Source1: httpd-default.conf
Source2: httpd-mpm.conf
Source3: httpd-ssl.conf
Source4: httpd-vhosts.conf
Source5: httpd-vhosts-ssl.conf
License: Apache License, Version 2.0
URL: http://httpd.apache.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Prefix: /home/esedev12/base_apache/httpd-2.2.22_depl

The Apache HTTP Server is a powerful, efficient, and extensible web server.

%setup -q -n %{name}-%{version}.%{release}

rm -rf srclib/{apr,apr-util,pcre}

%configure \
--prefix=%{_prefix} \
--program-prefix=%{_prefix} \
--datadir=%{_prefix} \
--includedir=%{_includedir} \
--libdir=%{_libdir} \
--libexecdir=%{_libexecdir} \
--mandir=%{_mandir} \
--sbindir=%{_bindir} \
--sysconfdir=%{_sysconfdir} \
--enable-mods-shared="all ssl ldap cache proxy authn_alias mem_cache file_cache authnz_ldap charset_lite dav_lock disk_cache
" \

make %{?_smp_mflags} EXTRA_CFLAGS="-Werror-implicit-function-declaration"

rm -Rf %{buildroot}
make DESTDIR=%{buildroot} install

install -m 644 -p $RPM_SOURCE_DIR/httpd.conf \

for f in httpd-default.conf httpd-mpm.conf httpd-ssl.conf httpd-vhosts.conf httpd-vhosts-ssl.conf; do
install -m 644 -p $RPM_SOURCE_DIR/$f \

mkdir $RPM_BUILD_ROOT%{_sysconfdir}/ssl.key
mkdir $RPM_BUILD_ROOT%{_sysconfdir}/ssl.crt


DOMAIN=`grep "search" /etc/resolv.conf | awk '{ print $2 }'`
SERVICE=`/service/bin/svcmon -na | awk '{ print $1 }'`

sed -i "s|SERVICENAME|$SERVICENAME|" $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
sed -i "s|SERVICE|$SERVICE|" $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
sed -i "s|USER02|esedev12|g" $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
sed -i "s|GROUP|esedev|" $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf

for f in httpd-ssl.conf httpd-vhosts.conf httpd-vhosts-ssl.conf; do
sed -i "s|SERVICENAME|$SERVICENAME|" $RPM_BUILD_ROOT%{_sysconfdir}/extra/$f
sed -i "s|SERVICE|$SERVICE|" $RPM_BUILD_ROOT%{_sysconfdir}/extra/$f
sed -i "s|USER02|esedev12|g" $RPM_BUILD_ROOT%{_sysconfdir}/extra/$f

umask 077

%define sslkey %{_sysconfdir}/ssl.key/server.key
%define sslcert %{_sysconfdir}/ssl.crt/server.crt

export PK_PASS=`openssl rand -base64 37`
echo "#!/bin/sh" > $RPM_BUILD_ROOT%{_sbindir}/pp-filter
echo "echo \"$PK_PASS\"" >> $RPM_BUILD_ROOT%{_sbindir}/pp-filter && chmod 750 $RPM_BUILD_ROOT%{_sbindir}/pp-filter

if [ ! -f %{sslkey} ]
openssl genrsa -des3 -out %{sslkey} -passout "env:PK_PASS" 4096

if [ ! -f %{sslcert} ] ; then
cat << EOF | openssl req -new -key %{sslkey} \
-x509 -days 365 -out %{sslcert} \
-passin "env:PK_PASS" -passout "env:PK_PASS" 2>/dev/null

%dir %{_bindir}

and so on
Problem is when the "install" part of PHP is calling apxs to dynamically load the PHP module. it is failing at make install part. it is not able to find the httpd.conf file.


Reply With Quote

apxs, build, error, php, rpm

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Build error with Fedora 16 - thoggen - dependency build error - hal? jonathonp Using Fedora 4 17th November 2011 08:59 AM
apache, apxs, mod_ssl daniel_I_l Servers & Networking 1 10th January 2010 03:15 PM
How to install apxs on FC2? andreluizfelix EOL (End Of Life) Versions 4 8th July 2008 08:01 AM
Where is the Apache apxs tool? yinglcs Using Fedora 2 19th January 2007 07:39 PM
apxs -i mod_auth_mysql.so question Secret Agent Servers & Networking 5 23rd January 2005 10:43 PM

Current GMT-time: 14:47 (Sunday, 01-02-2015)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
...rose harrypotter on Instagram for europe Tag loveher madrid Instagram Tag