Installing apache, php and mysql on ALT Linux

I’ve installed ALT Linux Lite on my laptop because windows XP worked very slow there (my laptop is outdated :)). When I decided to install apache there, I got some problems. This post is for people who have troubles with gcc on ALT linux.

Here is the error I got when tried to configure Apache with configure command line:

configure: error: in `srclib/apr`:
configure: error: C compiler cannot create executables
See `config.log` for more details.
configure failed for srclib/apr

I’ve search around the web looking for solutions for similar problem. The solution is to find and install some rpms to make the gcc compiler work. Here are the rpms you should find:

binutils-2.13.90.0.4-alt2.i586.rpm
cpp2.96-2.96-alt3.i586.rpm
gcc2.96-2.96-alt3.i586.rpm
glibc-devel-2.2.6-alt0.6.i586.rpm
kernel24-headers-2.4.20-alt5.i586.rpm
kernel-headers-common-1.0-alt2.noarch.rpm
libbfd-2.13.90.0.4-alt2.i586.rpm
update-alternatives-1.8.3-alt1.noarch.rpm

Then I began installing them (switched to root user with `su` command):

# rpm -i update-alternatives-1.8.3-alt1.noarch.rpm
# rpm -i cpp2.96-2.96-alt3.i586.rpm
# rpm -i kernel-headers-common-1.0-alt2.noarch.rpm
# rpm -i kernel24-headers-2.4.20-alt5.i586.rpm
# rpm -i glibc-devel-2.2.6-alt0.6.i586.rpm
# rpm -i libbfd-2.13.90.0.4-alt2.i586.rpm
# rpm -i binutils-2.13.90.0.4-alt2.i586.rpm
# rpm -i gcc2.96-2.96-alt3.i586.rpm

You might need to search for another rpms if you get any conflict installing them. In fact, the workflow is as follows:

1. Try to install gcc first. You will get conflicts.
2. Download the necessary rpms. Try to install them. If you get conflicts again, repeat the step.
3. When you satisfy all the conflicts you should finally have gcc installed.

Here are some more rpms I had to download from ftp.altlinux.org and install to make the gcc work for me:
gcc4.1-4.1.1-alt11.i586.rpm
gcc4.1-c++-4.1.1-alt11.i586.rpm
gcc-c++-common-1.4.10-alt2.i586.rpm
glibc-2.5-alt4.i586.rpm
glibc-devel-2.5-alt4.i586.rpm
glibc-kernheaders-2.6.17-alt6.i586.rpm
iconv-2.5-alt4.i586.rpm
kernel-headers-common-1.1.9-alt1.i586.rpm

Finally, I got the ./configure --enable-rewrite command work for Apache.

Then I execute:

make
make install
/usr/local/apache2/bin/apachect1 start

That’s all to have apache installed. The document directory is at /usr/local/apache2/htdocs and the site can be accessed by localhost.localdomain

Installing MySQL:

Download the source distribution for mysql, extract and run the configure command:

./configure --prefix=/usr/local/mysql --with-named-curses-libs=/usr/lib/ncurses.so.5.6

I had to add --with-named-curses-libs, because the configure generated error on my ALT Linux 4.0 Lite:

No curses/termcap library found

I’ve installed libncurses-devel-5.6-alt3.i586.rpm

Follow instructions listed here:

Installation from source distribution

Installing php.

I’ve downloaded the most recent version from php.net: php 5.2.8

Extracted the tar.gz and entered into the directory. Tried ./configure, but it failed with errors.

Then had to install some rpms to make configure work:

zlib-devel-1.2.3-alt4.i586.rpm
libxml2-devel-2.6.28-alt1.i586.rpm

The configure command:

./configure --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs

Then:

make
make install
cp php.ini-dist /usr/local/lib/php.ini

Then edit apache httpd.conf file:

LoadModule php5_module modules/libphp5.so

And add handler for mime type:

AddType application/x-httpd-php .php .phtml

Restart apache.