Fedora Linux Support Community & Resources Center
  #1  
Old 24th July 2012, 09:20 PM
darkfiz Offline
Registered User
 
Join Date: Jul 2012
Location: France
Posts: 2
windows_7chrome
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 :

Quote:
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 :

Quote:
%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/
Vendor: RESG/GTS/MKT/MDW/ACP
Packager: RESG/GTS/MKT/MDW/ACP
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: httpd
#= %{_apacheversion}
Requires(pre): httpd
#= %{_apacheversion}

%description
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.

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

%build
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 \
%else
--with-libdir=lib \
%endif
--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 \
--with-zlib

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

%install
rm -Rf %{buildroot}
make install INSTALL_ROOT=$RPM_BUILD_ROOT

%clean
rm -Rf $RPM_BUILD_ROOT

%files
%defattr(750,esedev12,esedev)
%dir %{_bindir}
%{_bindir}/php
%{_bindir}/php-cgi
%{_bindir}/php-config
%{_bindir}/phpize
%{_bindir}/pear
%{_bindir}/peardev
%{_bindir}/pecl

%defattr(750,esedev12,esedev)
%dir %{_sysconfdir}

%defattr(640,esedev12,esedev)
%{_sysconfdir}/pear.conf

%defattr(750,esedev12,esedev)
%{_libdir}/*

%defattr(750,esedev12,esedev)
%dir %{_mandir}
%dir %{_mandir}/man1
%{_mandir}/man1/php.1
%{_mandir}/man1/phpize.1
%{_mandir}/man1/php-config.1

%defattr(750,esedev12,esedev)
%{_includedir}/*

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

%defattr (640,esedev12,esedev)
/.channels/.alias/pear.txt
/.channels/.alias/pecl.txt
/.channels/.alias/phpdocs.txt
/.channels/__uri.reg
/.channels/doc.php.net.reg
/.channels/pear.php.net.reg
/.channels/pecl.php.net.reg
/.depdb
/.depdblock
/.filemap
/.lock
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.

Regards,

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

BuildRequires: httpd


should be


BuildRequires: httpd-devel

You probably have other missing deps, check here for list

https://koji.fedoraproject.org/koji/...?rpmID=3228565

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

Hi,

Apache is also a custom RPM with no sub packages. Please find the content of the SPEC file :
Quote:
%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/
Vendor: RESG/GTS/MKT/MDW/ACP
Packager: RESG/GTS/MKT/MDW/ACP
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Prefix: /home/esedev12/base_apache/httpd-2.2.22_depl

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

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

%build
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
" \
--with-pcre

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

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

install -m 644 -p $RPM_SOURCE_DIR/httpd.conf \
$RPM_BUILD_ROOT/%{_sysconfdir}/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 \
$RPM_BUILD_ROOT%{_sysconfdir}/extra/$f
done

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

%clean
rm -Rf $RPM_BUILD_ROOT

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

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
done

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} ]
then
openssl genrsa -des3 -out %{sslkey} -passout "env:PK_PASS" 4096
fi

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
--
FR
Ile-De-France
MY COMPANY
MY OU
$SERVICENAME
root@$SERVICENAME
EOF
fi

%files
%defattr(750,esedev12,esedev)
%dir %{_bindir}
%{_bindir}/ab
%{_bindir}/apxs
%{_bindir}/apachectl
%{_bindir}/checkgid
%{_bindir}/dbmmanage
%{_bindir}/envvars
%{_bindir}/envvars-std
%{_bindir}/htcacheclean
%{_bindir}/htdbm
%{_bindir}/httxt2dbm
%{_bindir}/htdigest
%{_bindir}/htpasswd
%{_bindir}/httpd
%{_bindir}/logresolve
%{_bindir}/rotatelogs

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.

Regards,

DarkFiz
Reply With Quote
Reply

Tags
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 07:59 AM
apache, apxs, mod_ssl daniel_I_l Servers & Networking 1 10th January 2010 02: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 06:39 PM
apxs -i mod_auth_mysql.so question Secret Agent Servers & Networking 5 23rd January 2005 09:43 PM


Current GMT-time: 18:28 (Thursday, 17-04-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

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