Tiba-tiba pengen maen-maen PHP di Slackware, mau gak mau akhirnya harus install Apache web server. Gimana caranya? Begini nih.....
Pertama cek dulu, apakah service-nya udah jalan atau belom. Siapa tau udah berjalan.
root@c1c4x_lab:~# nmap -sS localhost
Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2006-07-29 16:13 WIT
Interesting ports on localhost (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
37/tcp open time
113/tcp open auth
587/tcp open submission
6000/tcp open X11
Nmap run completed -- 1 IP address (1 host up) scanned in 1.056 seconds
ow, ternyata service httpd belom berjalan. So mari kita mulai. apache terletak di direktori /etc/apache terus edit file httpd.conf
root@c1c4x_lab:~# cd /etc/apache
root@c1c4x_lab:/etc/apache# pico httpd.conf
Untuk mengaktifkan modul PHP, agar apache bisa mengeksekusi .php maka aktifkan baris
Include /etc/apache/mod_php.conf dengan menghapus tanda # (pagar), biasanya terletak di bawah sendiri. Kalo pengen apache-nya mendukung SSL (Secure Socket Layer), maka aktifkan juga modul SSL-nya.
....baris atas sengaja di hapus....
# ==> mod_php configuration settings mod_ssl configuration settings < ==
#
# PACKAGES REQUIRED: apache (N series) and openssl (N series)
#
Include /etc/apache/mod_ssl.conf
Jalankan servicenya:
root@c1c4x_lab:/etc/apache# /etc/rc.d/rc.httpd start
-bash: /etc/rc.d/rc.httpd: Permission denied
Lho koq denied? Oh iya lupa, file permissionnya belom execute. Kalo gak percaya mari kita lihat dan buktikan :D Pergi ke drektori /etc/rc.d
root@c1c4x_lab:~# cd /etc/rc.d
root@c1c4x_lab:/etc/rc.d# ls -al rc.httpd
-rw-r--r-- 1 root root 401 2003-03-06 04:28 rc.httpd
Tuh kan, permissionnya masih default yaitu 644, so perlu diganti dulu permissionnya.
root@c1c4x_lab:/etc/rc.d# chmod 755 rc.httpd
root@c1c4x_lab:/etc/rc.d# ls -al rc.httpd
-rwxr-xr-x 1 root root 401 2003-03-06 04:28 rc.httpd*
sekarang jalankan service-nya, kemudian test pake nmap.
root@c1c4x_lab:/etc/rc.d# /etc/rc.d/rc.httpd start
/usr/sbin/apachectl start: httpd started
root@c1c4x_lab:/etc/rc.d# nmap -sS localhost
Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2006-07-29 16:24 WIT
Interesting ports on localhost (127.0.0.1):
(The 1652 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
37/tcp open time
80/tcp open http === service httpd telah berjalan
113/tcp open auth
587/tcp open submission
6000/tcp open X11
Selain command
/etc/rc.d/rc.httpd start, bisa juga digunakan command
apachectl, seperti berikut:
root@c1c4x_lab:/etc/rc.d# apachectl stop
/usr/sbin/apachectl stop: httpd stopped
root@c1c4x_lab:/etc/rc.d# apachectl start
/usr/sbin/apachectl start: httpd started
Direktori htdocs, secara default terletak di
/var/www/htdocs. Direktory bisa diubah dengan melakukan edit di
httpd.conf
Sekarang kita cek di browser, apakah service telah berjalan dengan baik. Dan apakah web server telah mendukung php. Bwat file phpinfo.php, untuk menguji apakah web server bisa menjalankan .php
http://localhost == telah berjalan dengan semestinya
http://localhost/phpinfo.php == dapat berjalan berarti telah mendukung .php
Ahh...... akhirnya bisa maen-maen php di Slackware dehh. I Love Slackware :D :D