Sunday, February 26, 2012

Konfigurasi php & mysql Slackware 13.37

  

  • PHP


  1. Download paket php-nya terlebih dahulu.

    # wget http://kambing.ui.ac.id/slackware/slackware-13.37/slackware/n/php-5.3.6-i486-6.txz

      atau

    # slackpkg install php


  2. Jika mendownload paketnya, install dulu dgn perintah

    # installpkg php-5.3.6-i486-6.txz


  3. Edit konfigurasi file httpd.conf

    # nano /etc/httpd/httpd.conf

      Cari baris yang mengandung kata dibawah ini

       # Uncomment the following line to enable PHP:

      kemudian, edit menjadi seperti ini

       AddType application/x-httpd-php .php
      Include /etc/httpd/mod_php.conf


  4. Restart service apache dengan perintah

    # httpd -k restart
     
    atau

    # /etc/rc.d/rc.httpd restart


  5. Untuk mengujinya buat lah file info.php di /var/www/htdocs/ (default directory dari apache)

    # cd /var/www/htdocs

    # nano info.php


      <?php 
      phpinfo();
      ?>
    

    tekan ctrl+x dan ketik 'y' untuk save dan exit. pada browser coba ketikkan di URLnya:

      localhost/info.php

    kalau muncul begini berarti konfigurasi telah benar.




  • MYSQL

  1. Install database mysqlnya
  2. # mysql_install_db
  3. Mengubah hak akses kepemilikan dari direktori /var/lib/mysql yang tadinya hanya milik root doang menjadi milik user dan grup mysql. sintaksnya kurang lebih begini:

    # chown userownerbaru:grupownerbaru file_atau_direktori

      jadi kita ketikkan

    # chown mysql:mysql /var/lib/mysql/


  4. Mengubah hak akses tempat kita akan membuat database nanti

    # chmod 755 /var/lib/mysql/

    Hore, sekarang kita udah bisa membuat dan menjalankan database mysql :D. Tinggal menjalankan mysql daemonnya saja.

    # chmod +x /etc/rc.d/rc.mysqld

    # /etc/rc.d/rc.mysql start



     Coba jalankan mysqlnya

    # mysql

    Welcome to the MySQL monitor. Commands end with ; or \g.

    Your MySQL connection id is 15

    Server version: 5.1.56-log Source distribution



    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

    This software comes with ABSOLUTELY NO WARRANTY. This is free software,

    and you are welcome to modify and redistribute it under the GPL v2 license



    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



    mysql>


     Udah bisa kan? tp karena defaultnya ga ada password, kita pakein aja biar aman.

    # mysqladmin -u root password password-yang-diinginkan


    Untuk mengaksesnya lagi

    # mysql -u root -p
    Enter password:




    Your MySQL connection id is 15

    Server version: 5.1.56-log Source distribution



    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

    This software comes with ABSOLUTELY NO WARRANTY. This is free software,

    and you are welcome to modify and redistribute it under the GPL v2 license



    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.



    mysql>



    Selesai! semoga berhasil kawan.

1 comments:

Unknown said...

perbanyak tulisan lagi raz :D

Post a Comment