Đang chuẩn bị liên kết để tải về tài liệu:
Phát triển web với PHP và MySQL - p 27

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Accessing Your MySQL Database from the Web with PHP CHAPTER 10 235 Bear in mind that there is a limit to the number of MySQL connections that can exist at the same time. The MySQL parameter max_connections determines what this limit is. The purpose of this parameter and the related Apache parameter MaxClients is to tell the server to reject new connection requests rather than allowing machine resources to be all used at busy times or when software has crashed. You can alter both of these parameters from their default values by editing the configuration files. To set MaxClients in Apache, edit. | Accessing Your MySQL Database from the Web with PHP 235 Chapter 10 Bear in mind that there is a limit to the number of MySQL connections that can exist at the same time. The MySQL parameter max_connections determines what this limit is. The purpose of this parameter and the related Apache parameter MaxClients is to tell the server to reject new connection requests rather than allowing machine resources to be all used at busy times or when software has crashed. You can alter both of these parameters from their default values by editing the configuration files. To set MaxClients in Apache edit the httpd.conf file on your system. To set max_connections for MySQL edit the file my.conf. If you use persistent connections and nearly every page in your site involves database access you are likely to have a persistent connection open for each Apache process. This can cause a problem if you leave these parameters set to their default values. By default Apache allows 150 connections but MySQL only allows 100. At busy times there might not be enough connections to go around. Depending on the capabilities of your hardware you should adjust these so that each Web server process can have a connection. Choosing a Database to Use You will remember that when we are using MySQL from a command line interface we need to tell it which database we plan to use with a command such as use books We also need to do this when connecting from the Web. We perform this from PHP with a call to the mysql_select_db function which we have done in this case as follows mysql_select_db books The mysql_select_db function has the following prototype int mysql_select_db string database int database_connection It will try to use the database called database. You can also optionally include the database link you would like to perform this operation on in this case db but if you don t specify it the last opened link will be used. If you don t have a link open the default one will be opened as if you had .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.