Tuesday, August 7, 2007

Hướng dẫn cài đặt Apache, MySQL và PHP5 cho người mới học

I. Cài Apache :
Mở Terminal (Applications > Accessories > Terminal) và khỏ zô dòng sau :
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5
sudo apt-get install libapache2-mod-security
Gói
mod-security là tuỳ chọn.
Để khởi động cái Apache server lên mình gõ zô Terminal dòng sau :
sudo /etc/init.d/apache2 start
Để kiểm tra coi Apache cài được chưa , zô webbrowser( như FireFox hay InternetExplorer) gõ vào addressbar :
http://localhost
Nếu nó ra chữ "It's work" là thành công ròi.
II.Cài đặt PHP
Mở Terminal (Applications > Accessories > Terminal) và khỏ zô dòng sau :
sudo apt-get install php5
sudo apt-get install php5-ldap php5-odbc php5-xsl php5-gd php-pear
sudo /etc/init.d/apache2 restart
Các gói cài đặt trong dòng lệnh thứ hai là tuỳ chọn. Dòng lệnh cúi là để restart lai server của mình, cho mục đích test của mình sau này.
Test PHP
Trong Terminal gõ :
sudo gedit /var/www/testphp.php
Chúng ta code mã PHP sau vào và save lại. Vào web browser vào address bar gõ zô :
http://localhost/testphp.php
Nếu thấy jống hình sau là cài Apache và PHP ổn ròi.
III. Cài đặt MySQL:
Lại mở Terminal ra và khỏ :
sudo apt-get install mysql-server

Để các máy khác trong mạng có thể coi được máy bạn, vào file my.cnf sửa lại chút xíu. Trong Terminal khỏ :
sudo gedit /etc/mysql/my.cnf
Tại dòng : bind-address = 127.0.0.1 Sửa lại 127.0.0.1 thành IP của bạn.
Bi jờ, bạn cài đặt thêm phpMyAdmin để tiện cho việc wản trị database của bạn. Trong Terminal khỏ :
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Để cho PHP và MySQL làm việc với nhau, bạn vào file php.ini sửa lại một chút. Vào Terminal gõ :
sudo gedit /etc/php5/apache2/php.ini
Sửa ;extension=mysql.so thành extension=mysql.so
Jờ thì bạn vào Terminal gõ lệnh sau để khởi động lại Apache và PHP, ròi típ tục làm việc với nó được ròi.
Để bảo mật hơn bạn nên đổi password ngay.
sudo /etc/init.d/apache2 restart
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
Đổi "yourpassword" thành mật khẩu tuỳ ý của bạn.
Chúc bạn thành công !

How to install LAMP( Linux, Apache, MySQL, PHP) on Ubuntu 7.04( Feisty Fawn)

Ubuntu is a free, open source Linux-based operating system that starts with the breadth of Debian and adds regular releases (every six months), a clear focus on the user and usability (it should "Just Work", TM) and a commitment to security updates with 18 months of support for every release (and with 6.06 LTS you get 3 years on the desktop and 5 on the server!). Ubuntu ships with the latest GNOME release as well as a selection of server and desktop software that makes for a comfortable desktop experience off a single installation CD.
I have found very easy steps to install Apache 2, PHP 5, MySQL 5 and PostgreSQL 8. All you need to do is to run the following command from the shell in Ubuntu, Upon password request, just enter the password for your personal account.

To install Apache 2

sudo apt-get install apache2-mpm-worker

To install MySQL 5
sudo apt-get install mysql-server
To install PHP 5
autoconf automake1.4 autotools-dev libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php-pear php5-ldap php5-mhash php5-mysql php5-pgsql php5-mysqli php5-snmp php5-sqlite php5-xmlrpc php5-xsl php5-imap php5-mcrypt php5-pspell php5-gd
This command will install most commonly used PHP libraries.
It used to take me the whole day even without successfully installing and configure those software packages, but it only took me less than 2 hours to finish all the installation and configure properly to suit my needs on Ubuntu. Plus, I really like the interface of Ubuntu desktop and now I will move my freelance project development to Ubuntu environment from Windows.
A few reasons to install Ubuntu:


  • Absolutely Free of Charge - you can download any time from their official website

  • Fast, Easy Install - only around 10 mins

  • Immediately Useful - contains all basic software for home and office applications

  • More securer than Windows
by www.edreaminghome.com - Eric Lin

Install gPHPEdit in Ubuntu, a good PHP editor review

gPHPEdit is not the most complete editor that you will ever use and has a simple and unclutered interface which makes writing code easy. Its based on the Scintilla editor and takes it a step further than SciTE and uses Gnome 2. What it lacks in features it makes up with pure speed. It’s opened at exactly the last place you left it before you can blink your eye. The main features are:

  1. Syntax highlighting for all functions up to PHP 4.3
  2. Code assistance (function, parameter assistance PHP 4.3 only)
  3. Syntax checking
  4. Tabbed viewing
  5. Support for HTML and CSS
syntax highlighting works but if you’re like me as you can tell from the site I like to work with a black background (otherwise after a while I have very sore eyes) and after changing all the setting there still remained some portions of the code with the default white background. On searching the site this bug has been fixed and will be included for the 1.0 release or can be downloaded via cvs. Another thing working with a black background when selecting text that is white you can’t read it anymore as there is no way to change the hight lighting color.

The PHP code assistance is great and just like the application is displayed very quickly and can be adjusted. The syntax checker is manual and has to be called using the menu or F9 this can be quite annoying and it does not check any functions or parameters within the file.

The search facilities are very basic in that only one file can be searched and the searching only highlights the first occurrence at the top of the file and you must continue through each occurance within the file. This can be quite tedious for large files with many partial matches.

If you’re working on a large project with multiple folders navigation can be quite tedious although on smaller projects where all files are in a small number of folders the handy list of classes with their functions can be displayed on the left of the screen for easy navigation but beware of files that have functions only as they will be listed so a folder containing numerous files of this type can be very difficult to navigate.

Overall, this editor is quick and easy to work with but without some more advanced features it feels a bit naked, the lack of automated indentation and auto syntax checking become more and more frustrating after long term use. Quick folder navigation would be an enormous improvement and these three feature would alone push this application onto the desktop of many more developers. Despite the lack of more advanced features it isn’t a tool I would quickly uninstall. If you’re an Eclipse user for example and you want to quickly open a couple of files to view and perform small edits this is where it excels. In the time that eclipse starts you can open edit and save and be doing something else. This application is reaching version 1.0 and is showing the some good signs that with some further development and added features would be a much more useful application.

Download gPHPedit source for Ubuntu here.

Các bạn có thể xem bài dịch tiếng Việt http://binkun-linux.blogspot.com/2007/08/hng-dn-ci-gphpedit-lp-trnh-php-trong.html.

Hướng dẫn cài gPHPEdit để lập trình PHP trong Ubuntu dễ dàng

gPHPedit không như hầu hết các trình biên tập( tạm dịch editor như vậy) hoàn chỉnh mà bạn đã từng xài. Có một giao diện đơn giản và không fức tạp, một điều thật tuyệt để code. Nó thiết kế trên nền Scintilla editor, là một bước tiến so với SciTE và dùng Gnome 2. Nó mở file chính xác theo lần cuối mà đóng trước trong nháy mắt.
Những chức năng chính của gPHPedit :

  • Làm nổi bật các hàm trong PHP 4.3.
  • Hỗ trợ code( hỗ trợ các hàm, tham số chỉ trong PHP 4.3).
  • Kiểm tra cú pháp.
  • Hỗ trợ kiểu cửa sổ Tab( mở nhiều tài liệu cùng 1 cửa sổ, nhưng các tài liệu trên các phiếu khác nhau).
  • Hỗ trợ cho cả CSS và HTML nữa.
Sự hỗ trợ cho code PHP thì thật tuyệt và giống như gPHPedit, nó hiển thị rất nhanh chóng và có thể chỉnh sửa. Tiện ích kiểm tra cú pháp( syntax) đươc chạy thủ công fải được gọi bằng menu hay nhấn F9 để gọi, điều này có lẽ khá khó chịu nhưng nó sẽ không check bất cứ hàm hay tham số nào trong file.
Tiện ích tìm kiếm từ là rất cơ bản trong các chương trình hỗ trợ lập trình, nhưng gPHPedit chỉ tìm trên một file thôi, điều này thật khó chịu cho ai làm việc với các project nhìu file hay các file wá lớn.
Sau cùng, chương trình này làm việc rất nhanh chóng và dễ dàng. Nhưng nếu như không có các tiện ích ưu việt hơn nó sẽ trở nên khá đơn điệu, thiếu hỗ trợ thụt đầu dòng và tự động kiểm tra lỗi cú pháp sẽ gây khó khăn cho việc sử dụng lâu dài sau này. Việc thíu một số tính năng hấp dẫn có thể sẽ làm bạn nhanh chóng gỡ bỏ nó, nhưng khoan đó lại là ưu điểm của nó đó bạn. Khi bạn cần chỉnh sửa chi tiết nhỏ một file nó sẽ rất hữu ích, như NotePad trong Window OS hay gEdit trong Ubuntu này, nó thật vô vị bù lại "nhỏ mà có zõ".
Các bạn có thể xem bài gốc tiếng Anh tại đây : http://binkun-linux.blogspot.com/2007/08/install-gphpedit-in-ubuntu-good-php.html
Và download gPHPedit tại đây.