Friday, June 1, 2007

step 3 — compiling php 5.2.3 on debian linux

this is last step before you get complete LAMP system.

before you start anything, please point your browser to install notes from php site. you right man if you always have a fresh copy of off-line docs (best one).

first, you need to get php source code. i like swedish locations (good speed) and smaller bz2 compressions, so chose where do you want to save and extract after files and run this:

now in that dir we need decompress archive. this will create "php-5.2.3" directory
tar -xvvf php-5.2.3.tar.bz2

this step is not necessary if you build it for a first time, but after you sholud do this (for finding out, why my new compile not work properly with all options that i added - i spent all day, just for this simple thing)
make clean or make distclean

cd to new folder and try to check your config
./configure --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/httpd/bin/apxs --with-mysqli --with-gd --with-zlib --enable-mbstring --with-freetype-dir --enable-gd-native-ttf --with-jpeg-dir --enable-bcmath

it is never (i think) passed on first time ;-) so for this my conf i was need these packages: libmysqlclient14, libmysqlclient14-dev, libxml2, libxml2-dev, libpng3, libjpeg62, libjpeg62-dev, libgd-dev, libfreetype6-dev

also, it was a little trouble to understand, why php cant see mysql installation, this should help (we put path to mysql into linux environment PATH):
export PATH=/usr/local/mysql/bin:$PATH

if configure passed, we can smile and start make phase. (for my double P-II 350 MHz it took ~30 mins)
make -j4
-j option is for SMP systems (more than one CPU). it's CPU_COUNT*2

i found that PHP team provide us some testcases, so we can use it for find out any compiling bugs or smthing
make test

before install phase, make sure that apache is not running (ps ax | grep httpd)
/etc/init.d/apachectl stop
make install

export CFLAGS="-O3 -msse -mmmx -march=pentium3 -mcpu=pentium3 -funroll-loops -mfpmath=sse -fomit-frame-pointer"

--with-tidy (libtidy, tidy, tidy-dev)
--enable-bcmath = Enable bc style precision math functions
--enable-memory-limit (prior to 5.2.1) for memory_get_usage(), memory_get_peak_usage() and 'memory_limit' configuration directive. /art.shtml?num=8508

No comments:

Post a Comment