, ,
NickSoft Linux Cookbook Index NickSoft Linux Cookbook
Quick howto's, Real live examples.
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Apache+PHP staticly linked and MySQL compile howto [beta]

Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> Apache
View previous topic :: View next topic  

Vote for this article
1 - useless
 0%  [ 0 ]
2 - bad
 0%  [ 0 ]
3 - not so bad
 0%  [ 0 ]
4 - good
 0%  [ 0 ]
5 - excelent
 100%  [ 1 ]
Total Votes : 1

Author Message
Site Admin

Joined: 13 Nov 2006
Posts: 22

PostPosted: Mon Nov 13, 2006 3:45 pm    Post subject: Apache+PHP staticly linked and MySQL compile howto [beta] Reply with quote

This howto is not confirmed by users. Please write to Support forum if you have troubles or find any mistakes.

download apache, php, mysql and mod_ssl to /usr/local/src directory.
untar them:
tar zxf apache-1.3.37.tar.gz
tar jxf php-4.4.4.tar.bz2
tar zxf mysql-4.1.21.tar.gz
tar zxf mod_ssl-2.8.28-1.3.37.tar.gz
mv apache_1.3.37 apache-1.3.37

Last step is important! if you skip it you'll have to adjust all commands that comtain apache directory.

1. Start with mysql (php needs mysql):
cd /usr/local/src/mysql-4.1.21
./configure --prefix=/usr/local/mysql --without-debug \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/tmp/mysql.sock \
--with-mysqld-user=mysql \
--without-docs \
--without-debug \
--without-bench \
--with-charset=cp1250 \
--with-extra-charsets=all \
--without-isam \
--with-innodb \
--enable-thread-safe-client \
--enable-assembler \
--with-archive-storage-engine \
make install
groupadd mysql
useradd mysql -g mysql
cd /usr/local/mysql
chown root . -R
chgrp mysql . -R
chown mysql ./data -R
echo 'delete from mysql.user where user="" '|mysql
./bin/mysqladmin -u root password 'new-password'

You may want to change --with-unix-socket-path to /var/lib/mysql/mysql.sock or /var/run/mysql.sock - default location for mysql socket for some systems.
Choose a charset with --with-charset=cp1250

One more thing to finish mysql installation. copy /usr/local/mysql/share/mysql/mysql.server script to right place in your system.

For redhat/fedora:
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --level 345 mysqld on
service mysqld start
For Slackware:
cp /usr/local/mysql/share/mysql/mysql.server /etc/rc.d/rc.mysqld
/etc/rc.d/rc.mysqld start

2. Install PHP

To proceed with php you need to run configure on apache:
cd /usr/local/src/apache-1.3.37
./configure --prefix=/usr/local/apache

Then compile and install PHP:
cd /usr/local/src/php-4.4.4
./configure --with-apache=../apache-1.3.37/ \
--with-mysql=/usr/local/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--disable-all \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php \
--enable-magic-quotes \
--with-gd=/usr \
--with-freetype-dir \
--with-ttf \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-zlib \
--enable-session \
--enable-sockets \
--with-pcre-regex \
--with-pear=/usr/local/php/lib/pear \
--enable-mbstring \
--disable-mbregex \
--enable-zend-multibyte \
--with-iconv \
--with-curl \
--with-ncurses \
make install

Notes on PHP:
--with-ncurses is optional and most of the time is not required. Also you must have include files for ncurses (devel package). You can safely skip this
--enable-mbstring and --with-iconv are needed to convert between character encodings. If you plan to use only one encoding you can skip it. However soon or later you may need them. Also some open source PHP products uses them. mbstring functions start with mb_ and iconv start with iconv_. See php documentation for more information
--with-ttf and --enable-gd-native-ttf require freetype library.

3. Install MODSSL
You need to configure ssl before you compile apache:
cd /usr/local/src/mod_ssl-2.8.28-1.3.37
./configure --with-apache=../apache-1.3.37 \

4. Compile and install apache

cd /usr/local/src/apache-1.3.37
./configure --prefix=/usr/local/apache \
--activate-module=src/modules/php4/libphp4.a \
--enable-module=rewrite --enable-shared=rewrite \
--enable-module=proxy   --enable-shared=proxy \
--enable-module=auth_digest --enable-shared=auth_digest \
--enable-module=proxy --enable-shared=proxy \
--enable-module=usertrack --enable-shared=usertrack \
--enable-module=asis --enable-shared=asis \
--enable-module=cgi --enable-shared=cgi \
--enable-module=log_agent --enable-shared=log_agent \
--enable-module=log_referer --enable-shared=log_referer \
--enable-module=unique_id --enable-shared=unique_id \
--enable-module=usertrack --enable-shared=usertrack \
--enable-module=userdir --enable-shared=userdir \
--enable-module=setenvif --enable-shared=setenvif \
--enable-module=vhost_alias --disable-shared=vhost_alias \
--enable-module=so --disable-shared=so \
--enable-module=info --disable-shared=info \
--enable-module=ssl --disable-shared=ssl \
--enable-module=status --disable-shared=status
make certificate
make install
groupadd apache
useradd apache -g apache

Notes on Apache
--enable-shared and --disable-shared specify if module will be built as shared(first) or it'll be included into apache executable. If you use specific module frequently it is recomended to build it as static module (vhost_alias for example).
proxy module is dagerous. If you don't know how to use it I recommend you to turn it off into your httpd.conf

Edit your httpd.conf located in /usr/local/apache/conf directory. Find user and group tags and set user and group to apache:
User apache
Group apache

Other tags you need to change are:
# changing document rood directory is not a must, but I use more friendly dir:
DocumentRoot "/webroot"
# or alternatively you can put link to apache's docs directory:
ln -s /usr/local/apache/htdocs /webroot

Find this in apache config file:
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
And replace DirectoryIndex directive with:
DirectoryIndex index.php index.html index.htm
This will allow you to use .php index file as well as .html

Find "<IfModule mod_mime.c>" in httpd.conf file and locate AddType entries like:
AddType application/x-tar .tgz
Put this above it in order php to work:
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps

Needed libraries that are not installed by default on some systems
(where xxx represents package version)
These packages are contain mostly include files. It is possible linux distribution you are using to contain source files instead includes. In this case packages may be called - package-source-xxx or package-xxx.src.tar.gz
if you do not have them you can you can skip corresponding options (mostly in php configuration):
--with-freetype-dir \
--with-ttf \
--with-ncurses \
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> Apache All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum Magic Eight Ball Croler Web Search Croler Web Directory Bianca Ryan

Powered by 220V