You are not logged in.

#1 2010-09-08 08:02:54

craig_nz
Member
Registered: 2010-09-08
Posts: 4

Compiling Apache 2.2 and php 5.2 from source on Arch

Hi there

Wanting to compile Apache 2 with PHP 5 on my Arch server. I figure this must be frequently done by people out there wanting more control over how their servers are setup, and was wondering if anyone had some good documentation for this? If none exists I'm keen to work on putting it up on the Arch Wiki.

I've compiled apache httpd-2.2.16 from source already, and have it running nicely.

Apache compile options were:

./configure --prefix=/usr/local/apache  \
--enable-rewrite --enable-ssl --enable-so \
--enable-mime-magic --enable-suexec \
--enable-static-rotatelogs \
--disable-imap --disable-userdir --enable-cgi \
--disable-dav  \
--disable-proxy-connect --disable-proxy-ftp --disable-proxy-http --disable-proxy \
--disable-authnz-ldap
$ /usr/local/apache/bin/httpd -Vvv
Server version: Apache/2.2.16 (Unix)
Server built:   Sep  6 2010 06:10:41
Server's Module Magic Number: 20051115:24
Server loaded:  APR 1.4.2, APR-Util 1.3.9
Compiled using: APR 1.4.2, APR-Util 1.3.9
Architecture:   32-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr/local/apache"
 -D SUEXEC_BIN="/usr/local/apache/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

Now installing PHP from source is proving to not work out so easily.

  root@server: ~/source-programs/apache/httpd-2.2.16/php-5.2.14
$ ./configure with-apxs2=/usr/local/apache/bin/apxs  --prefix=/usr/local/apache/php 
configure: warning: with-apxs2=/usr/local/apache/bin/apxs: invalid host type
loading cache ./config.cache
checking for Cygwin environment... (cached) no
checking for mingw32 environment... (cached) no
checking for egrep... (cached) grep -E
checking for a sed that does not truncate output... (cached) /bin/sed
checking host system type... with-apxs2=/usr/local/apache/bin/apxs
checking target system type... with-apxs2=/usr/local/apache/bin/apxs
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking for icc... no
checking for suncc... no
checking whether gcc and cc understand -c and -o together... (cached) yes
checking how to run the C preprocessor... gcc -E
checking for AIX... no
checking whether ln -s works... (cached) yes
checking for system library directory... lib
checking whether to enable runpaths... yes
checking if compiler supports -R... (cached) no
checking if compiler supports -Wl,-rpath,... (cached) yes
checking for gawk... (cached) gawk
checking for bison... (cached) bison -y
checking for bison version... (cached) invalid
configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 (found: none).
checking for flex... (cached) flex
checking for yywrap in -lfl... (cached) yes
checking lex output file root... (cached) lex.yy
checking whether yytext is a pointer... (cached) yes
checking for working const... (cached) yes
checking for flex version... (cached) invalid
configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4  (found: )
checking for re2c... no
configure: warning: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking whether to force non-PIC code in shared modules... no
checking whether /dev/urandom exists... yes
checking for pthreads_cflags... (cached) -pthread
checking for pthreads_lib... (cached) 

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking whether to enable Apache charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS... no
checking for Apache 1.x (hooks) module support via DSO through APXS... no
checking for Apache 1.x (hooks) module support... no
checking whether to enable Apache charset compatibility option... no

I end up with the PHP bin files, but just can't get the module to compile.

$ /usr/local/apache/php/bin/php -v     
PHP 5.2.14 (cli) (built: Sep  6 2010 05:37:45)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies


Have tried to make Apache execute php bin via CGI without any luck, but I think I'd rather work on compiling PHP into a module properly.

Any help or pointers in the right direction would be greatly appreciated.

Thanks

Last edited by craig_nz (2010-09-08 08:07:13)

Offline

#2 2010-09-08 11:34:52

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Compiling Apache 2.2 and php 5.2 from source on Arch

It's probably easiest to get the PHP PKGBUILD from ABS and add/change any compilation parameters there. The great advantage is that you can install it normally with Pacman, installing directly from source is almost always a bad idea.


ᶘ ᵒᴥᵒᶅ

Offline

#3 2010-09-08 22:25:30

craig_nz
Member
Registered: 2010-09-08
Posts: 4

Re: Compiling Apache 2.2 and php 5.2 from source on Arch

Can ABS be used if you want to download the source from other project sites? As in if I wanted to be pulling code from a SVN server. ABS looks like it still uses Arch repositories.

I'll give ABS a go and see if I can take anything from the compilation parameters for PHP.

Offline

#4 2010-09-09 10:10:42

ga01f4733
Member
From: NYC
Registered: 2008-12-05
Posts: 117

Re: Compiling Apache 2.2 and php 5.2 from source on Arch

some extra clues !

http://wiki.archlinux.org/index.php/LAMP    ;check the php-apache pkg


There are no foreign lands. It is the traveler only who is foreign. --R.L Stevenson

Offline

#5 2010-09-09 10:24:15

craig_nz
Member
Registered: 2010-09-08
Posts: 4

Re: Compiling Apache 2.2 and php 5.2 from source on Arch

Thanks for this!

Using:

 ./configure \
--with-apxs2=/usr/local/apache/bin/apxs  \
--prefix=/usr/local/apache/php \
--disable-cgi
--enable-so \
--enable-rewrite \

make
libtool --finish /root/source-programs/apache/httpd-2.2.16/php-5.2.14/libs

In /usr/local/apache/modules I get:
libphp5.a  libphp5.la

No libphp5.so yet but closer.. Also looking at how I can use ABS just to compile php.

Offline

#6 2011-01-30 14:00:20

armintirand
Member
Registered: 2011-01-30
Posts: 23

Re: Compiling Apache 2.2 and php 5.2 from source on Arch

hi
i want to compile all of the software in arch that i need. i dont like using pacman.in this case i want to compile  apache and php in arch.this is second software that i compile.the firest name aria2.i compile it very nice,but apache is not!can you help me?

Offline

Board footer

Powered by FluxBB