My status

My backup memory

Chủ Nhật, 18 tháng 12, 2011

Cấu hình Apache + PHP để hỗ trợ cài đặt vtiger

Mục đích: câu hình PHP và Apache để hỗ trợ cài đặt vtiger cùng với website khác. Tuy nhiên yêu cầu PHP settings khác với vhost khác -> tìm cách cấu hinh  Apache để hỗ trợ nhiều PHP configuration.
vtiger php.ini file settings
Option | Setting
Safe Mode | Off
Display Errors | On
File Uploads | On
Register Globals | Off
Max Execution Time – 300
output_buffering – On
Change the memory limit – 16M
error_reporting – E_WARNING & ~E_NOTICE
allow_call_time_reference – On
output_buffering – On
log_error = off
GD Library support
extension=php_gd2.dll (remove the comments)
IMAP Support
extension=php_imap.dll (remove the comments)

For custom views to work, need to set in php.ini:
register_long_arrays – MUST be set to On. It is set to Off by default.-------------------------
Phương án tạo 1 file php.ini riêng dành cho vtiger không ổn (php.ini đặt trong thư mục vtiger). Sau khi tìm hiểu -> cần xác định PHP được cấu hình trong Apache theo cách nào: PHP installed as Apache-CGI hay PHP installed as a Apache 2.2.x Module -> xác định được XAMPP khi cài đặt đã cấu hình PHP as Apache modules (PHPinfo.php thể hiện Server API là Apache 2.0 handler) -> do cài đặt trên Windows nên ko thể sử dụng .htaccess. Cấu hình trong httpd.conf và httpd-vhosts.conf không có tác dụng (apache service không thể start được). Đã tham khảo:

Mục dưới đây giải thích sơ bộ:

PHP 5.3.3 Thread Safe or Non-Thread Safe?

PHP 5.3.3 is available for download in either Thread Safe or Non-Thread Safe packages. This "what is?" question is generally second on the list for those about to download this server-side scripting software.
Thread Safe Vs Non-Thread Safe is the subject of programming for mulitcore and multiprocessor systems where we can slice up one instruction into multi instructions. Each of these new slices is called a thread of execution that can execute concurrently. Thus they thrive in, and offer vastly superior processing speed under suitable anarchistic environments. Depending on the skill of the coder, situations can arise.
With speed as the sacrifice, thread safety seeks to reign in the anarchy to avoid situations such as Race Conditions (where different threads try to update the same global variable at the same time), Deadlock, Starvation etc. Most operating systems use the Portable Operating System Interface for Unix (POSIX) standards which includes the subject of threading.
Yes, but which thread type should we download?
If you are using or wish to use PHP as an Apache Module under Windows, the only available option is the PHP Thread Safe download which technically speaking is also the correct choice. You would also ensure your chain of dependant programs and binaries you have Php use are threadsafe too by checking the appropriate documentation or forum boards for those programs or binaries. In this scenario, Apache will provide the correct MPM for threadsafety (more information is in our Apache 2.2.17 guide if needed).
If using PHP independently to run your CGI requests from Apache, both Thread Safe and Non-Thread Safe options are available.
So the final decision will be based on how you wish to setup your website. You may wish to review the differences between module and cgi set ups (appears later in the guide) before making a choice.
And another factor is that setting up a system to test your scripts before uploading them to different web site can influence your installation decision. It is recommended you use the same setup found on that server. But how can you know what PHP Thread type your server is using? A simple and easy way to do this is to use a simple script like the phpinfo.php script which can be found in the article Which is my Website, Apache Mod PHP or Apache CGI?. The resulting information will let you know if Thread Safety is enabled or disabled on that site. If disabled, use the NTS version. Of course, this script will only work if PHP is already setup for use on that server.
Verifying which ThreadSafety mode is in use with PHP info.
(Fig. 0)
And so we find that TS is used mostly for those using PHP 5.3.3 as an Apache module and NTS for those running PHP 5.3.3 as Apache CGI (and Apache CGI will require a text edit to our httpd.conf file under either installation method and will be explained in our testing section). It is simple to change the install type if you change your mind at a later date.
If you are free to choose which ever type you like, and are still unsure as to which is the best for your use, you may want to review the information found in the section named Apache CGI Vs Module (pg4) and is linked in our Install Guide Index.

Apache Cgi Vs Apache Module

When the PHP installer asks you to choose between PHP 5.3 as Apache-Cgi versus PHP 5.3 as an Apache Module, you address a question which is similar to the decision made between choosing a Threadsafe or Non Threadsafe option. This is because this decision also effects the way in which the programmer writes his code in the software.
Only the Thread Safe installer offers both options:
a) Apache-CGI or,
b) Apache2.2.x Module
The main point to undestand is that if you choose Apache-Cgi, your binaries run independantly of Apache. And if php is a module of apache, then of course apache is more aware of the Php environment and thus less secure in a shared server situation. Popular applications (MySql etc.) will run just fine under either setup method.
We can see then that Apache-CGI tends to be favored by those seeking a more secure environment. As Apache's CGI handler, PHP then goes about it's business with little care to others users who may be sharing your same server. For example, it is easier to obfuscate your passwords file and keep it's location unknown to other server users etc.
But running PHP as an Apache2.2.x Module has some distinct advantages. Some of these being that running the PHP interpreter as an Apache module is the easiest to setup, it is the most common type of setup used in pre-configured solutions and is very well supported in popular website server software and scripts. Best of all, this method is currently inclined to be much faster than the Apache-CGI option. The downside being that Apache2.2.x Module has special needs to increase security. See these notes for more on adding security when using Apache2.2.x Module.
Does my website use PHP Apache 2.2.x Module or Apache CGI?
Questions like: Which version or sort of PHP is my Host Website Server running? Is it Apache CGI (installed as a CGI Binary so that Apache uses Php as a Cgi Interpreter) or is it Apache 2.2.x Module (installed as an integral part of Apache structure)? can be expected by the Website Administrator from his more tech savvy clients (if they look to install PHP5.3 on a local computer and want to match their server with the same type of setup).
Knowing the answer to this question can be particularly useful before uploading your scripts to a web server. Code can differ between the two PHP types (CGI & Module). Like coding password entry for example. So it is a good idea the Website Administrator knows a couple of tricks to distinguish between them.
Let's first cut to the chase with this list. It is explained further at the bottom of the page, but for those of you who already know what you are looking for, this will resolve the question:
Quick Thread Safety (and) Server API Inspection Chart
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thread Safety =

PHP is a NonThreadSafe install (and therefore installed as Other-CGI)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thread Safety =
(+) Server API =

ThreadSafe installer used with PHP installed as Apache-CGI)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thread Safety =
(+) Server API =
Apache 2.0 Handler

ThreadSafe installer used with PHP installed as a Apache 2.2.x Module.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Another method is check the output our first PHPinfo script displays to see if Server API: is equal to Apache 2.0 Handler or CGI/FastCGI. Apache 2.0 Handler is only used in a Threadsafe / Apache 2.2.x Module install. You can also find a section near the top named apache2handler which will also show you what modules are installed in your setup. Other sections that show up only in a Threadsafe / Apache 2.2.x Module install are: Apache Environment HTTP and Headers Information. It's just not quite as much fun to do it this way. View Chart.
Sau khi đọc kỹ hơn thấy có thể cấu hình tham số cho php ngay trong https-vhosts.conf. Tham khảo các links sau:
chú ý link dưới cho thấy directive nào dùng được trong vhost:
Changeable là PHP_INI_PERDIR PHP_INI_ALL dùng khai báo php_value còn PHP_INI_SYSTEM dùng khai báo php_admin_value
Do các directives cần cho vtiger đều thuộc nhóm PHP_INI_PERDIR PHP_INI_ALL do vậy trong httpd-vhosts.conf chỉ cần dùng khai báo php_value.

2 nhận xét:

  1. đang cố gắn cái đặt bản 5.2.1 - nhưng vẫn chưa đc . bạn cho mình xin nick YH đc ko
    thank !

    Trả lờiXóa
  2. DreamHost is definitely the best website hosting company for any hosting services you need.

    Trả lờiXóa