PHP4 upgrade to 5 connection database (sqlserver2000) Slow solution

Source: Internet
Author: User
Tags phpinfo
PHP4 Connection Database (sqlserver2000) slows after upgrade to 5
System environment
Windows2000 Server
SQL Server 2000 (installed on a different machine)
Apache 1.3.X (same as apache2.2)
PHP 5.2.8 (used to be 4.X soon)

The connection database is found to be slow (more than 2 seconds) after upgrade
Other code is quickly
Because it is local area network access, basically no delay, so this two seconds appears very obvious.
==========
Test code
This will be slow (the database itself is no problem if you don't feel the delay with PHP4)
echo "Hello";
$server = "12.34.56.78";
$username = "UU";
$password = "PP";
$CNN =mssql_connect ($server, $username, $password);
mssql_select_db (' MyDB ', $cnn);
echo "Hello";
Phpinfo ();
========
If only
echo "Hello";
Phpinfo ();
Soon, so I judged that the time needed to connect the database grew longer.



------Solution--------------------
sqlserver2000 is very old, php5.2.8 a lot younger. Hehe, a bit of a problem with it, feel slow to change the database version or PHP version of it.

Of course, if you have the conditions, consider using the same PHP version and database version on the other machine to test to see if there is the same problem.
------Solution--------------------
%......
------Solution--------------------
Cite the Landlord Carpenter01 post:
System environment
Windows2000 Server
SQL Server 2000 (installed on a different machine)
Apache 1.3.X (same as apache2.2)
PHP 5.2.8 (used to be 4.X soon)

The connection database is found to be slow (more than 2 seconds) after upgrade
Other code is quickly
Because it is local area network access, basically no delay, so this two seconds appears very obvious.
==========
Test code
This will be slow (the database itself is no problem if you don't feel the delay with PHP4)
echo "Hello";
$server = "12.34.56.78";
$username = "UU";
$p ...

------Solution--------------------
discuss
Reference:
Database connections are time-consuming processing,
PHP5 's Zend engine has changed a lot compared to PHP4,
You do this every time you request, you connect the code once, the speed is not fast.

It is recommended not to upgrade the server casually, it is better to return to php4.x.


Do not understand, how to write can reduce the number of connections to the database ah?
In addition, I also tested the installation of PHP5 after the other machine has not slowed down, I can not find the reason AH

------Solution--------------------
Come in and share.
  • 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.