LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-15-2007, 08:56 AM   #1
e.v.o
LQ Newbie
 
Registered: Mar 2007
Location: Germany
Distribution: Slackware 12.0
Posts: 18

Rep: Reputation: 0
[HowTo] Compile Apache2 with PHP5


Ok,.. it was a very hard and rough way for me.. but finally i did it. Was just damn simple but sometimes there are things that won't work the way you want
  1. Stop your apache:
    Quote:
    apachectl stop
    and.. to be save: check if httpd really isn't running anymore:
    Quote:
    ps aux |grep httpd
    it should look like this:
    Code:
    root@[ ~/ ]$ ps aux |grep httpd
    root     25756  0.0  0.0   1876   604 pts/0    R+   14:16   0:00 grep httpd
  2. Uninstall all apache and php versions using pgktool and delete all config files for a real fresh install as i wanted it. don't forget to back up your ssl certs
  3. - Go to /usr/src:
    Quote:
    cd /usr/src
    - get httpd sources: http://httpd.apache.org/download.cgi
    - or directly: - or get the package from linuxpackages.net as i did, cause i don't wanted to compile anymore ;>
    - get php5 sources: http://www.php.net/downloads.php
    - or directly: - unpack everything:
    Quote:
    tar xfvz httpd-2.2.4.tar.gz && tar xfvj php-5.2.1.tar.bz2
  4. - go to your httpd dir and choose how and what should be compiled with apache2:
    Quote:
    cd httpd-2.2.4
    ./configure --help
    - normally this will be used by myself:
    Quote:
    ./configure --enable-modules=most --enable-mods-shared=most --enable-so --enable-ssl --enable-info --enable-cgi --enable-rewrite --enable-mime-magic --enable-usertrack --enable-deflate
    - everythings ok without any warnings, errors? if you get errors you probably are missing some libs
    - compile and install:
    Quote:
    make && make install
  5. - do the same with php (be sure to have the newest libs installed... swaret or slapt-get will help you):
    Quote:
    cd ../php-5.2.1
    ./configure --help
    - choose your settings or simply use mine (no vhosts):
    Quote:
    ./configure --with-apxs2=/usr/sbin/apxs --enable-fastcgi --disable-ipv6 --with-openssl --with-zlib --with-bz2 --with-curl --enable-exif --enable-ftp --with-gd --with-gettext --with-ldap --with-mhash --with-mysql --with-ncurses --enable-sockets --with-sqlite --with-xsl --enable-zip
    make && make install
  6. - configure everything:
    Quote:
    libtool --finish /usr/src/php-5.2.1/libs
    cp .libs/libphp5.so /usr/local/apache2/modules
    ldconfig <- just to be sure
    cp php.ini-recommended /usr/local/include/php/php.ini
    cp php.ini-recommended /usr/local/lib/php/php.ini
    - edit httpd.conf:
    Quote:
    jed /etc/apache2/httpd.conf
    - make sure this line is in your /etc/apache2/httpd.conf:
    Quote:
    LoadModule php5_module lib/apache2/libphp5.so
    - edit the following part:
    Quote:
    <IfModule dir_module>
    DirectoryIndex index.html
    </IfModule>

    - to this:

    <IfModule dir_module>
    DirectoryIndex index.php index.html
    </IfModule>
    - edit
    Quote:
    Quote:
    <IfModule mime_module>
    ...
    </IfModule mime_module>
    -change to

    Quote:
    <IfModule mime_module>
    ...

    # PHP Type and Handler
    AddHandler php5-script php
    AddType text/html php
    AddType application/x-httpd-php-source phps

    </IfModule mime_module>
    Quote:
    The php documentation recommends AddType application/x-httpd-php php instead of the above. However, it causes problems with the "MultiViews" feature of HTTP. That is, if the .php extension is left off a URL, and with certain browser Accept headers, Apache will not know .php (application/x-httpd-php) is HTML and will return a 406 Not Acceptable error. Using the AddType and AddHandler as shown above fixes this problem.
    - save everything...
  7. now we test if everythings ok:
    Quote:
    root@[ ~/ ]$ httpd -t
    Syntax OK
    root@[ ~/ ]$ httpd -v
    Server version: Apache/2.2.4 (Unix)
    Server built: Jan 23 2007 04:39:37
    root@[ ~/ ]$ httpd -V
    Server version: Apache/2.2.4 (Unix)
    Server built: Jan 23 2007 04:39:37
    Server's Module Magic Number: 20051115:4
    Server loaded: APR 1.2.7, APR-Util 1.2.7
    Compiled using: APR 1.2.7, APR-Util 1.2.7
    Architecture: 32-bit
    Server MPM: Prefork
    threaded: no
    forked: yes (variable process count)
    Server compiled with....
    -D APACHE_MPM_DIR="server/mpm/prefork"
    -D APR_HAS_SENDFILE
    -D APR_HAS_MMAP
    -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
    -D APR_USE_SYSVSEM_SERIALIZE
    -D APR_USE_PTHREAD_SERIALIZE
    -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
    -D APR_HAS_OTHER_CHILD
    -D AP_HAVE_RELIABLE_PIPED_LOGS
    -D DYNAMIC_MODULE_LIMIT=128
    -D HTTPD_ROOT="/usr"
    -D SUEXEC_BIN="/usr/bin/suexec"
    -D DEFAULT_PIDLOG="/var/run/httpd.pid"
    -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
    -D DEFAULT_LOCKFILE="/var/run/accept.lock"
    -D DEFAULT_ERRORLOG="logs/error_log"
    -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
    -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"
    root@[ ~/ ]$ httpd -S
    VirtualHost configuration:
    Syntax OK
    root@[ ~/ ]$ httpd -l
    Compiled in modules:
    ...
    root@[ ~/ ]$ httpd -M
    Loaded Modules:
    ...
    php5_module (shared)
    Syntax OK
  8. - start apache2:
    Code:
    apachectl start
    - test php:
    Code:
    echo "<?php phpinfo(); ?>" >/var/www/htdoccs/info.php
    - open http://localhost/info.php and you should see some strange information about your php installation...
    - check the logfile for errors:
    Code:
    jed /var/log/apache2/error_log

used links:would be nice if you could give me feedback
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SLES9, apache2 and php5 ... scabrous1 Linux - Software 2 01-31-2006 01:46 PM
SLES9/apache2 and PHP5 scabrous1 SUSE / openSUSE 1 12-15-2005 05:14 AM
Apache2 and PHP5 SpiderIRE Linux - Software 3 09-30-2005 03:25 PM
Apache2 and PHP5 rul3r Slackware 7 09-11-2005 05:21 PM
Apache2 + PHP5.0.3 24jedi *BSD 1 07-21-2005 03:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration