home  :: Home/Artikels/Kunst & technologie/Eigen webserver installeren met PHP en MySQL

Eigen webserver installeren met PHP en MySQL

Pagina 3 van 4
«vorige |1|2| 3 |4| volgende»
door: Joriso 

Download & installatie Apache / PHP / MySQL webserver op (Fedora) Linux

Als je snel een webserver wilt installeren is dit op Linux in veel gevallen simpeler dan op Windows. De installatiesoftware van veel gebruikersvriendelijke Linux varianten zoals bijv. Fedora, geven je de keuze o.a. Apache webserver met SQL en PHP mee te installeren.

Dus om het simpel te houden – Fedora linux downloaden, kiezen voor een custom installation en dan de opties webserver / apache en php en mysql aanvinken.

Indien je geen ervaring met Linux hebt is de gebruikersvriendelijke Ubuntu Linux (desktop) een goede keuze. Samen met Xampp voor Linux kun je binnen een uur je eigen webserver hebben draaien.

Compileren Apache / PHP / MySQL

Door Apache en PHP op je linux webserver te compileren kan er een aanzienlijke prestatie toename ontstaan. Dit is wel iets complexer maar als je dit ook wilt proberen: Installeer in dit geval Fedora met alleen de development tools (custom install)

Vervolgens de volgende Bestanden om te downloaden naar /usr/local/src


MySQL www.mysql.com (binary tar.gz)
Apache www.apache.org (source tar.gz)

Php www.php.net (source tar.gz)

Vervolgens de onderstaande scripts in je terminal window laten uitvoeren :

# Uitpakken :

cd /usr/local/src

tar zxvf $apache.tar.gz
tar zxvf $apc.tgz
tar zxvf $php.tar.gz
tar zxvf $Net_SSLeay.tar.gz
tar zxvf $mysql.tar.gz

# eerst met Yum de server updaten :

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* #voorkomt GPG key errors voor ghostscript fonts
yum install ImageMagick
yum update openssh*
yum update zlib-devel*

# MySQL installeren (binary distro) :

groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar -zxvf /usr/local/src/$mysql.tar.gz
ln -s $mysql mysql
cd mysql
scripts/mysql_install_db --user=mysql
chown -R root:mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/data
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 0755 /etc/rc.d/init.d/mysqld
chkconfig --levels 2345 --add mysqld # for auto startup

# Apache installeren
cd /usr/local/src/$apache

./configure \
--prefix=/usr/local/apache2 \
--enable-so \
--enable-ssl

make
make install

mkdir /usr/local/apache2/conf/ssl.key
mkdir /usr/local/apache2/conf/ssl.crt

cd /usr/local/apache2/conf/ssl.key
openssl genrsa -des3 -rand some_big_file_1:some_big_file_2 -out localhost.key 1024
openssl rsa -in localhost.key -out server.key
openssl req -new -key localhost.key -out localhost.key.csr
openssl x509 -req -days 365 -in localhost.key.csr -signkey localhost.key -out /usr/local/apache2/conf/ssl.crt/server.crt

# Simpele Apache Startup script zetten in /etc/init.d – zodat Apache bij ?n reboot automatisch herstart)
echo "#!/bin/sh
# description: apache2
# chkconfig: 2345 99 00

case \"\$1\" in
'start')
/usr/local/apache2/bin/apachectl startssl
touch /var/lock/subsys/httpd
;;
'stop')
/usr/local/apache2/bin/apachectl stop
rm -f /var/lock/subsys/httpd
;;
*)
echo \"Usage: \$0 { start | stop }\"
;;
esac
exit 0" > /etc/init.d/httpd
chkconfig --levels 2345 --add httpd # for auto startup
chmod 0775 /etc/init.d/httpd


# PHP installeren :

cd /usr/local/src/$php
if [ -f config.cache ] ; then
rm config.cache
make clean
fi

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysql=/usr/local/mysql \
--with-zlib \
--with-zlib-dir \
--with-curl \
--enable-track-vars \
--with-config-file-path=/usr/local/apache2/conf \
--enable-trans-id \
--enable-mbstring \
--enable-sockets \
--with-openssl

make
make install

# Kopieren van de phi.ini naar Apache conf map en aanpassen httpd.conf bestand

cp /usr/local/src/$php/php.ini-dist /usr/local/apache2/conf/php.ini
echo "AddType application/x-httpd-php .php" >> /usr/local/apache2/conf/httpd.conf
echo "<?phpinfo()?>" > /usr/local/apache2/htdocs/phpinfo.php

Indien je nu http://localhost/phpinfo.php in je browser opent, dien je de configuratiepagina van php op je webserver te zien:

phpinfo

Pagina 3 van 4
«vorige |1|2| 3 |4| volgende»



Commentaar van bezoekers:
van: jaja
15:10:40, 11th-Jan-08
inde tent gek

van: JP
10:45:21, 15th-Jan-08
echo "AddType application/x-httpd-php .php" >> /usr/local/apache2/conf/httpd.conf

Dit functioneert bij mij niet hoor. Deze regel moet in het <IfModule mime_module> staan...

van: Nahinder
19:34:16, 15th-Oct-08
Hartstikke tof :D

Maar ik kom niet verder bij het uitpakken

\"tar zxvf $apache.tar.gz
tar zxvf $apc.tgz
tar zxvf $php.tar.gz
tar zxvf $Net_SSLeay.tar.gz
tar zxvf $mysql.tar.gz \"

De server weigert dit :S

Ik heb al een uur gegoogled maar kom niet verder
Graag emailen naar nahinder@gmail.com

Commentaar toevoegen:
Naam:
Link:(niet verplicht)
Commentaar:
<-- code:
  

Pagina's in dit artikel:
pagina 3
Eigen webserver installeren met PHP en MySQL



Gerelateerde Artikels :
Kunst:

Snel zoeken:



Springende dolfijn
40 Euro

Toevallig
passerende
cartoon
:



Nieuwste links:


All content copyleft 2008 Joris Osterhaus - www.hardcode.nl