Installation:Gentoo:Apache

From PMWH2 - PHPMyWebHosting's official wiki
Revision as of 23:46, 25 March 2007 by Udomueller (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
up

On Debian GNU/Linux you need to install the following packages:

  • apache or apache2
  • php4
  • php4-mysql
  • phpmyadmin

On Debian GNU/Linux use this command to install all at once:

apt-get install apache php4 php4-mysql phpmyadmin

On Debian Woody there are a few workarounds to get PHP working. Open /etc/apache/httpd.conf with your favorite editor. Search for the "LoadModule" line containing the php4-module. If necessary, comment the line in (delete the #). After that search for "DirectoryIndex" and add "index.php" at the end of the line. Also search for "AddType" and comment in (delete the #) the following two lines:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Also setup "ServerAdmin" and "ServerName" with the correct values concerning your server. Comment out or delete the following section:

#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
    UserDir public_html 
</IfModule>

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS PROPFIND>
        Order allow,deny
        Allow from all  
    </Limit>
    <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
        Order deny,allow
        Deny from all   
    </Limit>
</Directory>

as this is not needed and not possible an this server.

Apache Virtual Host from SQL

To use MySQL as backend for apache install libapache-mod-sqlinclude from http://sourceforge.net/projects/mod-sqlinclude/ After install edit /etc/apache/httpd.conf. Remove any

NameVirtualHost and VirtualHost

entries from this file and add at module section

LoadModule sqlinclude_module /usr/lib/apache/1.3/mod_sqlinclude.so

and at the end

SQL_ServerName "localhost"
SQL_ServerPort 3306
SQL_SQLDB [database name]
SQL_SQLUser [database user]
SQL_SQLPassword [database password]
SQL_Include "SELECT concat(data,data2) from domains where data <> '' order by domain"
SQL_AbortOnError On
SQL_UseNameColumn Off

The most secure thing is to add a new user "www-data" to the mysql database which only has select rights on the domains table. Do this by typing the following command into mysql command line tool:

grant select on [database name].domains to www-data@localhost identified by "www-data"

and set above database user and password to this values. Configuration of apache is done.