Find the answer to your Linux question:
Results 1 to 3 of 3
Aloha, A while back I setup a Debian box running Apache and PHP using apt-get to install essentially all the elements required to get a working webserver. I'd now like ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2004
    Posts
    2

    Apache and PHP Installations via source Tutorials


    Aloha,

    A while back I setup a Debian box running Apache and PHP using apt-get to install essentially all the elements required to get a working webserver. I'd now like to learn how to setup Apache with PHP via the manual method of downloading, compiling and installing via the source packages.

    I currently have the required packages' source components and was wondering if anyone could reccommend any good tutorials / documentation for the manual installation. Much of what I've read insofar asks me to use apt-get, but while it does the job just fine, prevents me from garnering a good understanding of what the process is actually doing.

    Anyone able to point me in the direction of finding something reccommended along these lines ?

  2. #2
    Just Joined!
    Join Date
    Oct 2004
    Posts
    2
    Google and perseverance work wonders. Its insane how varying the same procedure can be explained by those who write HOW-TOS and documentation!

    As a side note, if anyone's reading - is APT-GET a Debian specific application ? Downloading and installing applications via the tar.gz archives I assume is the manual approach that will essentially 'work' on any flavour of Linux, though I'm curious as to whether APT-GET ( which works pretty well also ) is utilised by other distros.

  3. #3
    Linux Engineer jledhead's Avatar
    Join Date
    Oct 2004
    Location
    North Carolina
    Posts
    1,077
    apt is not default in other distros like in debian. I use it for redhat and fedora though (from http://dag.wieers.com/packages/apt )

    here is an excert from my in house apache-php install
    apache:
    Code:
    I got the latest stable tar from apaches website and compiled as described below:
    Extracted the tar 
    #tar zxvf httpd-2.0.49.tar.gz 
    in my user folder /home/jledford/ and then 
    # Cd httpd2.0.49
    # ./configure –prefix=/usr/local/apache2 –enable-mods-shared=all
    
    set the prefix (the directory to install apache, /usr/local/apache2) and also
    tell it which modules to compile and install. We will tell configure to compile
    and install all modules as shared DSO libraries, that way we can easily enable
    and disable them in the httpd.conf file.
    
    If configure fails to find the "C" Compiler and quits, run the following command.
    
    #apt-get install gcc.
    
    This will download the compiler, library and tools needed.
    
    After this completes, re-run cofigure.
    
    Next run make.
    # make
    
    This will compile the source code into executable binaries.
    
    Next run make install.
    # make install
    
    this will copy the binaries into the install directory and setup the modules.  For configure and make you do not need root access, for make install you will probably need root privileges.
    
    Apache is now install and you should be able to get to it by 
    # cd /usr/local/apache2
    all the apache files and folders should be in here
    start and stop apache with a file called apachectl
    # cd /usr/local/apache2/bin
    # ./apachectl start
    to start apache
    # ./apachectl stop
    to stop apache
    # ./apachectl restart
    # ./apachectl graceful
    both restart apache but graceful does it more gently, either will work though.
    Once you have started apache you can test it by going to (on the local machine) http://localhost and it should bring up the apache test page.
    
    Next run make clean to clean up all the temp files that were
    generated during the compile and linking processes.
    #make clean
    
    Now we need to get PHP working.
    download the latest tar from from www.php.net
    Untar that 
    #tar zxvf php-4.3.2.tar.gz 
    and then get in the dir
    # cd /home/jledford/php-4.3.2
    # ./configure –with-mysql –with-apxs2=/usr/local/apache2/bin/apxs
    # make
    # make install
    # make clean
    
    # vi /usr/local/apache2/conf/httpd.conf
    
    look for the area where you see all the LoadModule commands and we need to add a new line:
    LoadModule php4_module modules/libphp4.so
    now just reload apache.
    for testing create a file in your docroot called whateveryouwant.php
    inside the file put these contents
    Code:
    <?php
    phpinfo&#40;&#41;;
    ?>
    and then hit that file from your webbrowser. if all is working you should get a php info page telling you every detail about your php install. if you just get the code above php is not working

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •