How to solve the first time that java-PHP connects to Oracle is very slow

Source: Internet
Author: User
Tags codeigniter
The database uses Oracle11gPHP to connect to Oracle very slowly PHP to connect to oracle very slowly, reflected in, if not connected to oracle for a long time, then connect to oracle again, it will take 20 ~ 40 seconds. However, the subsequent connection will be very fast. Website architecture {code...} connection code (this line... the database uses Oracle 11g

PHP connection to Oracle is very slow

PHP is very slow to connect to oracle, as shown in the following figure: If you haven't connected to oracle for a long time, it will take 20 ~ to connect to oracle again ~ 40 seconds. However, the subsequent connection will be very fast.

Website architecture

PHP Version 5.5.12Apache 2.4.9Win7 64 connects to Oracle using the PHP OCI8 extension CodeIgniter

Connection Code (the first connection of this line of code will take 20 ~ 30 seconds later)

public function db_connect(){return @oci_connect($this->username, $this->password, $this->hostname, $this->char_set);}
Java webloig connection is fast

However, in addition, Java + Weblogic connects to this oracle database very quickly.

Seek Solutions

A member center is required, but the oracle database is used and the website is PHP. It is impossible for a user to wait for 20 to 20 for the first time ~ 40 seconds.

Reply content:

The database uses Oracle 11g

PHP connection to Oracle is very slow

PHP is very slow to connect to oracle, as shown in the following figure: If you haven't connected to oracle for a long time, it will take 20 ~ to connect to oracle again ~ 40 seconds. However, the subsequent connection will be very fast.

Website architecture

PHP Version 5.5.12Apache 2.4.9Win7 64 connects to Oracle using the PHP OCI8 extension CodeIgniter

Connection Code (the first connection of this line of code will take 20 ~ 30 seconds later)

public function db_connect(){return @oci_connect($this->username, $this->password, $this->hostname, $this->char_set);}
Java webloig connection is fast

However, in addition, Java + Weblogic connects to this oracle database very quickly.

Seek Solutions

A member center is required, but the oracle database is used and the website is PHP. It is impossible for a user to wait for 20 to 20 for the first time ~ 40 seconds.

Why not use PDO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.