PHP5FromSource

Differences between revisions 6 and 7
Revision 6 as of 2005-08-13 04:45:01
Size: 6659
Editor: S0106000d88b9f3db
Comment: link error
Revision 7 as of 2005-11-22 21:00:42
Size: 7246
Editor: 200
Comment: corrects a bug compilling php5 with support for mysql and mysqli simultaneous.
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
Tested in Hoary. Tested in Hoary and Breezy.
Line 102: Line 102:

You should point {{{--with-mysql}}} to the base directory of your mysql and {{{--with-mysqli}}} to the {{{mysql_config}}} file. Keep this in mind especially when you install php with support to a Mysql that you compilled yourself.
Line 159: Line 161:
--enable-memory-limit \
&& make -s \
--enable-memory-limit
}}}

'''ATTENTION'''

If you want to use both the old mysql and the new mysqli interface, load the Makefile into your editor and search for the line beginning with EXTRA_LIBS; it includes -lmysqlclient twice; remove the second instance. Do this before running the 'make' command or you'll get compilation errors.

{{{
make -s \
Line 166: Line 175:
Line 174: Line 184:

=== Comments ===

Note: There are currently three PHP5 pages on the wiki, this one, ["PHP5Installation"] and ["PHP5Installation2"]. If you're able to edit them down to just one page, please do! Remember to add redirects from the two pages you black, though - don't just delete those pages.

PHP4 does not require any special assembly or compiling; see ["ApacheMySQLPHP"] for PHP4 instructions.

Tested in Hoary and Breezy.

Prerequisites

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 !

You should point --with-mysql to the base directory of your mysql and --with-mysqli to the mysql_config file. Keep this in mind especially when you install php with support to a Mysql that you compilled yourself.

./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

ATTENTION

If you want to use both the old mysql and the new mysqli interface, load the Makefile into your editor and search for the line beginning with EXTRA_LIBS; it includes -lmysqlclient twice; remove the second instance. Do this before running the 'make' command or you'll get compilation errors.

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

Comments

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 Sad :(

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.

CategoryDocumentation CategoryCleanup

PHP5FromSource (last edited 2008-08-06 16:14:11 by localhost)