PHP5FromSource

Differences between revisions 1 and 8 (spanning 7 versions)
Revision 1 as of 2005-05-28 20:11:24
Size: 6291
Editor: adsl-213-190-44-43
Comment: imported from the old wiki
Revision 8 as of 2006-06-05 03:01:44
Size: 26
Editor: S0106000fb085cc63
Comment: redirect page\
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= PHP5 from source =

= PHP5 installation from source =

Tested in Hoary.

== Prerequisits ==

=== You must download PHP5 (of course ;) ===
{{{
wget http://www.php.net/get/php-5.0.4.tar.bz2/from/ie.php.net/mirror
tar jxf php-5.0.4.tar.bz2
cd php-5.0.4/
}}}
 
=== You must install packages : ===
{{{
sudo apt-get install make g++ flex bison build-essential zlib1g-dev
}}}

=== You must have a webserver : ===
(apache2-prefork is better because it is thread safe)
{{{
sudo apt-get install apache2-mpm-prefork apache2-prefork-dev
}}}
(you can install with apache2-mpm-worker, but you need to delete the --with-tsrm-pthreads)

(you also can install Apache 1 (no problem with thread there)

=== You need a Mysql Database I Think : ===
(not necessary, but recommended)

Choose between 4.0 and 4.1

__Mysql 4.0__
{{{
sudo apt-get install libmysqlclient12-dev mysql-server
}}}
'''OR'''

__Mysql 4.1__
{{{
sudo apt-get install libmysqlclient14-dev mysql-server-4.1
}}}

=== You need development libraries ===
We will install PHP with a lot of options (mcrypt, mhash, bz2, xml, tidy...)
{{{
sudo apt-get install libmcrypt-dev libmhash-dev libxslt1-dev libtidy-dev libbz2-dev libxml2-dev libssl-dev
}}}


If you install GD (it is in my configuration below)
{{{
sudo apt-get install libpng12-dev libjpeg62-dev libxpm-dev libfreetype6-dev freetype2 freetype2-dev
}}}


Enable the multiverse repository to have the msttcorefonts (Useful for TrueType fonts with GD).
The symbolic links is to Jpgraph to work without changing the configuration.
{{{
sudo apt-get install msttcorefonts
ln -sfn /usr/share/fonts/truetype/msttcorefonts/ /usr/X11R6/lib/X11/fonts/truetype
}}}


== Compilation optimisation ==

You can speed up PHP with processor optimisation (optional)

If you have a different processor, change the CHOST, CFLAGS, CXXFLAGS.

If you don't know what it is, this 3 lines are optional, so don't do it !

 * Athlon-tbird XP (AMD)
{{{
export CHOST="i686-pc-linux-gnu"
export CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -msse -mmmx -mfpmath=sse"
export CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -msse -mmmx -mfpmath=sse"
}}}

 * Pentium 4 (Intel)
{{{
export CHOST="i686-pc-linux-gnu"
export CFLAGS="-march=pentium4 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer -msse -mmmx -mfpmath=sse"
export CXXFLAGS="-march=pentium4 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer -msse -mmmx -mfpmath=sse"
}}}

== Configuration ==
This is a full configuration.

Do it in the PHP5 folder.

You can add/delete some of the options if you don't need it.

It is a strict PHP (no short tags, safe mode, no magic quotes etc...), but you can change it if you prefer or if some scripts doesn't work.

If you use Apache 1, change the {{{--with-apxs2=/usr/bin/apxs2}}} with {{{--with-apxs=/usr/bin/apxs}}}

If you have only Mysql 4.0, delete the {{{--with-mysqli=/usr/bin/mysql_config}}}
It is only with Mysql 4.1 !


{{{
./configure \
--quiet \
--disable-cli \
--disable-cgi \
--disable-all \
--disable-rpath \
--disable-debug \
--disable-path-info-check \
--disable-magic-quotes \
--disable-posix \
--disable-short-tags \
--disable-ipv6 \
--disable-static \
--disable-pcntl \
--without-pear \
--with-apxs2=/usr/bin/apxs2 \
--with-mysql=/usr \
--with-mysqli=/usr/bin/mysql_config \
--with-zlib \
--with-bz2 \
--with-dbx \
--with-ctype \
--with-openssl \
--with-pcre-regex \
--with-gettext \
--with-mcrypt \
--with-mhash \
--with-iconv \
--with-sqlite \
--with-sqlite-utf8 \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-xpm-dir \
--with-ttf \
--with-xsl \
--with-tsrm-pthreads \
--with-tidy \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-safe-mode \
--enable-calendar \
--enable-mbstring \
--enable-spl \
--enable-ftp \
--enable-bcmath \
--enable-sockets \
--enable-dom \
--enable-xml \
--enable-soap \
--enable-libxml \
--enable-session \
--enable-simplexml \
--enable-memory-limit \
&& make -s \
&& sudo make install \
&& sudo /etc/init.d/apache2 stop \
&& sudo /etc/init.d/apache2 start
}}}

The installation had automatically add PHP5 module to Apache Configuration


=== Testing ===
{{{
sudo echo "<?php phpinfo(); ?>" > /var/www/phpinfo.php
mozilla-firefox http://localhost/phpinfo.php
}}}

From AdrianFisher Sun May 22 13:21:42 +0100 2005
From: Adrian Fisher
Date: Sun, 22 May 2005 13:21:42 +0100
Subject: Error messages and problems
Message-ID: <20050522132142+0100@https://www.ubuntulinux.org>

These are the messages I get when I run the configuration script. It comes up after the PHP license box so I have been unable to finish the installation :(

rm: cannot remove `.libs/libphp5.la': Permission denied
rm: cannot remove `.libs/libphp5.la': Permission denied
rm: cannot remove `.libs/libphp5.lai': Permission denied
rm: cannot remove `.libs/libphp5.so': Permission denied
rm: cannot remove `.libs/libphp5.la': Permission denied
rm: cannot remove `.libs/libphp5.lai': Permission denied
rm: cannot remove `.libs/libphp5.so': Permission denied
/usr/bin/ld: cannot open output file .libs/libphp5.so: Permission denied
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

I also typed in http://localhost and it brings up a directory on-screen by the name of "apache2-default" and I am unable to use the lines from the testing section as when I try to create the file as mentioned in the first line I get the error message

"bash: /var/www/phpinfo.php: Permission denied".

Any help would be appreciated, thanks in advance.

From CarlosVogel Thu May 26 19:18:17 +0100 2005
From: Carlos Vogel
Date: Thu, 26 May 2005 19:18:17 +0100
Subject: Error in make
Message-ID: <20050526191817+0100@https://www.ubuntulinux.org>

The installation does not work to me.

when executing make, it happens the following error:

user@ubuntu:/php-5.0.4$ make -s
php-5.0.4/ext/sqlite/libsqlite/src/parse.y:19.1-13: directiva no válida: `%token_prefix'
php-5.0.4/ext/sqlite/libsqlite/src/parse.y:19.15-17: syntax error, unexpected "identifier"
make: *** [php-5.0.4/ext/sqlite/libsqlite/src/parse.c] Error 1

Help me please.

thanks.
#REDIRECT ApacheMySQLPHP