Using PHP-MySQL Persistent Connections to Run WordPress Blog Izmantojot PHP, MySQL noturīgiem Savienojumi ar Run WordPress Blog

When connecting to MySQL database, WordPress weblog based on PHP scripting will use non-persistent connection by default. Ja pieslēdzoties MySQL datu bāzi, WordPress weblog balstīta uz PHP skriptu izmantos nav pastāvīgs savienojums pēc noklusējuma. That is, WordPress will trigger PHP to generate a new connection to MySQL server for each dynamic page request, and subsequently close the database connection once the web page building is completed. Tas ir, WordPress izraisīs PHP, lai radītu jaunu savienojumu ar MySQL serveri katru dinamisku lapu pieprasījumu, un pēc tam aizveriet datu bāzi savienojums pēc tam, kad interneta lapas ēka ir pabeigta. Repetitive opening and closing of MySQL connections causes overheads and uses up precious CPU, memory and system resources on the web host. Atkārtotās atvēršanās un aizvēršanās MySQL savienojumi izraisa pieskaitāmās un pielietojums up precious CPU, atmiņas un sistēmas resursu tīmeklī uzņēmējā.

Using persistent connection to connect to MySQL database server is not always a good option. Izmantojot pastāvīgs savienojums, lai izveidotu savienojumu ar MySQL datu bāzes serveri, ne vienmēr ir laba iespēja. Each connections takes up resources, including memory, buffers, table or thread caches internally in MySQL and sockets, open files or IO activity at OS level. Katra savienojumi aizņem resursu, tostarp atmiņa, buferi, galda vai pavedienu Kešatmiņa iekšējai MySQL un uzmavas, atveriet failu vai IO darbību OS līmenī. Thus when a lot of persistent connections are opened but not closed after transactions are completed, the resources on system may drain up and degrade performance of web server, or in worst case, cause HTTP failure. Tādējādi, kad daudz noturīgi savienojumi ir atvērt, bet nav slēgti pēc darījumi ir pabeigta, resursu sistēma var aizplūšanu un noārdās izpildes tīmekļa servera, vai sliktākajā gadījumā, rada HTTP mazspēja. Furthermore, if a persistent connection is stalled, inactive or became defunct or no longer in used, it is not terminated, and MySQL server will only close it to release the resource occupied by the connection after about 28800 seconds (8 hours) by default unless changed the timeout parameters in my.cnf configuration files. Bez tam, ja ir pastāvīgs savienojums ir apstājies, neaktīviem vai kļuva nelaiķis vai vairs izmantot, tas nav pārtraukts, un MySQL serveri tikai aizvērt tā, lai atbrīvotu resursus, ko aizņem savienojumu apmēram pēc 28.800 sekundēm (8 stundas) pēc noklusējuma, ja vien mainīja timeout parametri my.cnf konfigurācijas failiem. This few factors may bring troubles such as MySQL refusing new DB connections or slow server if the applications do not properly handle persistent connections. Šis pāris faktori var radīt problēmas, piemēram, MySQL atteikt jaunu BP savienojumiem vai lēns serveris, ja pieteikumi nav pienācīgi rīkoties noturīgi savienojumi. Thus if you're not experience webmasters, please do not attempt to change Wordpress to use persistent connections. Tādējādi, ja jūs neesat pieredze tīmekļa pārziņiem, lūdzu Nemēģiniet mainīt WordPress izmantot noturīgi savienojumi.

However, for bloggers who have busy and large blog, and facing constraints in upgrading web host system specifications, and do not want to use static page caching plugin such as WP-Cache, persistent connection is a available option to tune and optimize the web server to see if the webpage serving can be faster. Tomēr, lai Emuāru autori, kuri ir aizņemts un lielo blogu, un vērsta ierobežojumus pārkārtošanās interneta uzņēmējas sistēmas specifikācijām, un nevēlaties izmantot statisku lapu caching spraudnis, piemēram, WP-Cache, pastāvīgs savienojums ir pieejama iespēja melodija un optimizēt interneta serveri lai redzētu, vai lapas, kas kalpo, var ātrāk. Persistent connection allows connection to be open once and will not be closed when the execution of the script ends. Noturīgiem savienojums ļauj pieslēgumu varētu atvērt vienu reizi, un nebūs slēgti, kad izpildi, skriptu galiem. Instead, the link is kept in pool and will remain open for future use. Tā vietā, saikni tur baseins un paliks atvērts izmantošanai nākotnē. Thus, using persistent connections will eliminate the process of opening and closing the connection. Tādējādi, izmantojot noturīgi savienojumi novērsīs process atvēršanās un aizvēršanās savienojumu. This will indirectly reduce MySQL connection related server overheads such as authentication to establish connection where only once is needed, saving extra network traffic, and resources used to handle extra connection. Tas netieši samazināt MySQL savienojums related servera pieskaitāmās piemēram, autentifikāciju, lai noteiktu saikni, ja tikai vienu reizi, ir nepieciešams, ietaupot papildu tīkla trafiku un resursi, lai apstrādātu papildu savienojumu. Beside, there could be some connection level caches, which need to be filled up for proper performance, and potentially reduce the number of connections to the database. Bez tam varētu būt daži savienojumu līmenis Kešatmiņa, kas jāaizpilda līdz pienācīgai izpildei un, iespējams, samazinātu to personu skaitu, savienojumi ar datu bāzi.

By default, WordPress is using mysql_connect() function that establishes a new database connection on every page. Pēc noklusējuma WordPress izmanto mysql_connect () funkciju, kas izveido jaunu datubāzi savienojums par katru lapu. The persistent connection feature will require mysql_pconnect() function which uses the exact same API, but has built-in connection pooling to keep connections alive between requests. Ilgstošie savienojums iezīme būs nepieciešama mysql_pconnect () funkcija, kas izmanto tieši tādu API, bet ir iebūvēts savienojums apvienošana, lai saglabātu savienojumu dzīvs starp pieprasījumu. So to switch to use persistent connection to run WordPress, the mysql_connect() function has to be replaced with mysql_pconnect(). Tātad, lai pārslēgtos izmantot pastāvīgs savienojums palaist WordPress, tad mysql_connect () funkcija ir jānomaina ar mysql_pconnect ().

To enable and use persistent connections with WordPress, simply login to your web host with SSH (or insecure Telnet), and change to the webroot home directory where WordPress blog is installed. Lai aktivizētu un izmantot noturīgi savienojumi ar WordPress, vienkārši ieejiet savā interneta uzņēmējas ar SSH (vai nedrošs Telnet), un izmaiņas, kas, webroot mājas direktoriju, kur WordPress blog ir uzstādīta. Then change directory into wp-includes directory. Tad mainīt directory vērā wp-ietver direktorijā. Inside the wp-includes directory, there is wp-db.php file. Inside the wp-ietver directory, ir wp-db.php fails. Use any text editor such as vi to edit wp-db.php. Izmantot jebkuru teksta redaktoru, piemēram, vi, lai rediģētu wp-db.php. Search or locate the function of mysql_connect (or @mysql_connect ). Meklēt vai atrodiet funkciju mysql_connect (vai @ mysql_connect). There is only one instance of mysql_connect. Ir tikai viena instance mysql_connect. Just change the mysql_connect to mysql_pconnect , then save and exit the wp-db.php. Vienkārši nomainiet mysql_connect uz mysql_pconnect, tad saglabātu un izietu no wp-db.php. WordPress and PHP (as long as you don't turn off the mysql.allow_persistent in PHP.INI) will immediately use persistent connections to connect to MySQL database. WordPress un PHP (kamēr jums nav izslēgtu mysql.allow_persistent in PHP.INI) nekavējoties izmantot noturīgi savienojumi, lai izveidotu savienojumu ar MySQL datubāzi. It's worth to try out which setting is best for your environment. Tas ir vērts izmēģināt, kas, kurā ir vislabākā jūsu vidē.

IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: Šī lapa ir mašīna tulkoto un ar nosacījumu ", kas ir" bez garantijas. Machine translation may be difficult to understand. Machine translation var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.


2 Responses to “Using PHP-MySQL Persistent Connections to Run WordPress Blog” 2 Atbildes uz "izmantojot PHP, MySQL noturīgiem Savienojumi ar Run WordPress Blog"

  1. raja Raja
    November 22nd, 2008 10:20 Novembris 22, 2008 10:20
    2 2

    THANK YOU SO MUCH! Thank you so much!
    WordPress is running so much faster now! WordPress darbojas tik daudz ātrāk tagad!

    I am running all on Windows Server 2008 with: Es esmu rādīt visas uz Windows Server 2008 ar:
    - MySQL Server v5.0 x64 (on dedicated server) - MySQL Server v5.0 x64 (par veltīta server)
    - IIS7 with FastCGI z32 (on dedicated server) - IIS7 ar FastCGI z32 (par veltīta server)

    Regards, Sveicieni,
    raja Raja

  2. Edward Edward
    September 27th, 2007 22:14 Septembris 27, 2007 22:14
    1 1

    This seemed to do the trick for. Tas, šķiet, darīt to triks par. Thanks so much for the info! Thanks so much par info!

Leave a Reply Atstāj atbildi

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Jūs varat izmantot šos tagus: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Parakstīties uz komentāriem iezīme ir atspējota. To receive notification of latest comments posted, subscribe to Lai saņemtu paziņojumu par jaunāko komentāri norīkots darbā, abonēt My Digital Life Comments RSS feed Mani Digital Life Comments RSS feed or vai register to receive reģistrēties, lai saņemtu new comments in daily email digest. jauni komentāri ikdienas e-pasta sagremot.
Custom Search

New Articles Jauns pants

Incoming Search Terms for the Article Incoming Meklēt Noteikumi par pants

mysql persistent connection mysql pastāvīgs savienojums - -- php mysql persistent connection php mysql pastāvīgs savienojums - -- php mysql wordpress php mysql WordPress - -- MySQL persistent connections MySQL noturīgi savienojumi - -- php mysql persistent connections php mysql noturīgi savienojumi - -- wordpress mysql connection WordPress mysql savienojums - -- mysql_pconnect wordpress mysql_pconnect WordPress - -- persistent connections mysql noturīgi savienojumi mysql - -- php persistent connections php noturīgi savienojumi - -- php mysql persistent php mysql noturīgas - -- wordpress persistent connection WordPress pastāvīgs savienojums - -- wordpress persistent connections WordPress noturīgi savienojumi - -- wordpress mysql timeout WordPress mysql timeout - -- persistent mysql pastāvīgs mysql - -- php persistent mysql connection php noturīgas mysql savienojums - -- php persistent connection php pastāvīgs savienojums - -- mysql php persistent connection mysql php pastāvīgs savienojums - -- mysql connections mysql savienojumi - -- persistent connection mysql php pastāvīgs savienojums mysql php - -- mysql allow persistent mysql ļauj noturīgas - -- mysql persistent mysql noturīgas - -- mysql persistent connection performance mysql pastāvīgs savienojums sniegumu - -- Wordpress connection to MySQL WordPress savienojums ar MySQL - -- persistent connection mysql pastāvīgs savienojums mysql - -- persistent connection php pastāvīgs savienojums php - -- php mysql persistant connection php mysql pastāvīgs savienojums - -- php mysql keep connection alive php mysql glabāt savienojums dzīvs - -- mysql persistent connect mysql noturīgi savienot - -- wordpress persistent mysql WordPress noturīgas mysql - -- wordpress mysql conn WordPress mysql CONN - -- mysql persistent links mysql noturīgas saites - -- steps to connect on mysql through wordpress pasākumus, lai izveidotu savienojumu ar mysql ar WordPress - -- wordpress mysql connection sleep WordPress mysql savienojumu miegs - -- Reduce or eliminate persistent connections to reduce connection usage Samazināt vai likvidēt noturīgu pieslēgumus, lai samazinātu savienojumu izmantošana - -- persistent connections noturīgi savienojumi - -- wordpress mysql persistent connection WordPress mysql pastāvīgs savienojums - -- persistent connection pastāvīgs savienojums - -- wordpress mysql_connect WordPress mysql_connect - -- wp mysql_connect wp mysql_connect - -- max connection mysql wordpress max savienojums mysql WordPress - -- wordpress mysql connections WordPress mysql savienojumi - -- mysql persistent connections php mysql noturīgi savienojumi php - -- php "mysql auth" changement de login php "mysql iestādes" changement de login - -- wordpress close connections WordPress tuvu savienojumi - -- mysql persistent connection timeout mysql pastāvīgs savienojums timeout - -- mysql connection pool for wordpress mysql savienojumu baseins uz WordPress - -- wordpress database connection pool WordPress datubāzē savienojums pool - -- is it required to close mysql connection in php Vai ir vajadzīgi, lai slēgtu mysql savienojumu php - -- wordpress + mysql_connect WordPress + mysql_connect - -- php + mysql + wordpress php + mysql + WordPress - --