Để giúp cho các bạn mới bắt đầu với LAMP, tôi xin đưa ra một vài vấn đề cơ bản đối với cấu hình php trong LAMP
Để thay đổi các thuộc tính tuỳ chọn cho PHP bạn hãy mở file php.ini ra (tất nhiên là phải có quyền root)
Sudo gedit /etc/php5/apache2/php.ini
Và dưới đây là một số tuỳ chọn
Thông báo lỗi, cảnh báo...
;Tuỳ chọn thông báo lỗi, warning... bạn nên đặt E_ALL & ~E_NOTICE để hiển thị tất cả lỗi, cảnh báo và thông báo
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
; E_ALL - All errors and warnings (doesn't include E_STRICT)
; E_ERROR - fatal run-time errors
; E_RECOVERABLE_ERROR - almost fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_STRICT - run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
Giới hạn dung lượng upload
;Dung lượng mặc định là 2M
post_max_size = 8M
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =
; Maximum allowed size for uploaded files.
upload_max_filesize = 8M
Các Extension mở rộng
;Đường dẫn đến thư mục chức các thư viện mở rộng của php
; extension_dir = "./"
; If you wish to have an extension loaded automatically, use the following
; syntax:
;Cấu trúc kích hoạt thư viện mở rộng
; extension=modulename.extension
;
; For example, on Windows:
;Ví dụ kích hoạt thư viện mở rộng cho kết nối CSDL Microsoft SQL Server trong windows
; extension=msql.dll
;
; ... or under UNIX:
;Ví dụ kích hoạt thư viện mở rộng cho kết nối CSDL Microsoft SQL Server trong UNIX (Linux)
; extension=msql.so
Thời gian thực hiện script
max_execution_time = 600 ; Mặc định là 30s, nếu chạy các script nặng (như backup hay restore DB chẳng hạn) thì sẽ bị timeout, nên tăng lên 600 cho thoải mái
max_input_time = 600 ; Maximum amount of time each script may spend parsing request data
Còn nữa....