Php5.3/php5.4 differs from previous versions and (php5.2x/php5.4x performance comparison)

Source: Internet
Author: User
Tags ereg e5620
1: Functionereg () isdeprecatedError error countermeasure Deprecated: Functionereg () isdeprecatedin ...... Solution 1: Return to php5.2. Solution 2: continue to use php5.3, but modify row 460 of develdevel. modul: if ($ errno (E_ALL ^ E_NOTICE) {change to if ($ errno (

1: Function ereg () is deprecated Error countermeasure Deprecated: Function ereg () is deprecated in ...... Solution 1: Return to php5.2. Solution 2: continue to use php5.3, but modify the 460 rows of devel/devel. modul: if ($ errno (E_ALL ^ E_NOTICE) {change to if ($ errno (

1: Function ereg () is deprecated Error Countermeasure

Deprecated: Function ereg () is deprecated in ......

Solution 1: Return to php5.2.

Solution 2: continue to use php5.3, but modify devel/devel. row 460 of modul: if ($ errno & (E_ALL ^ E_NOTICE) {changed to if ($ errno & (E_ALL &~ E_NOTICE &~ E_DEPRECATED) {ignore the deprecated error)

Solution 3: replace ereg with preg_match and ereg_replace with preg_replace.

Note that ereg ('^ [0-9]' must be changed to preg_match ('/^ [0-9]/'.

2: After PHP5.3 (set_magic_quotes_runtime (), ereg () has been disabled

The following error occurs when you run the php program:
Deprecated: Function set_magic_quotes_runtime () is deprecated


The cause is that this feature (set_magic_quotes_runtime () has been disabled after PHP5.3.
This feature has been completely removed from PHP6.
You can comment out or delete the wrong row, or add the @ symbol before set_magic_quotes_runtime.


PHP 5.3 ereg () cannot be used normally. The prompt "Function ereg () is deprecated Error" is displayed ". The root cause is that there are two Regular Expression Methods in php, one is posix and the other is perl. php6 intends to abolish the regular expression method of posix, so a preg_match is added later. The solution to this problem is simple. Add a filter prompt symbol before ereg to convert ereg () to @ ereg (). In this way, the prompt information is blocked, but the problem is still not solved. php uses ereg normally before version 5.2. After Version 5.3, preg_match should be used to replace ereg. So it needs to be changed to the following:

Ereg ("^ [0-9] * $", $ page)

To:

Preg_match ("/^ [0-9] * $/", $ page)

Note: The obvious difference between posix and perl is whether to add a slash. Therefore, compared with ereg, the latter adds two "/" symbols before and after the regular expression.
Tips: this problem does not occur in php5.2 or earlier versions.

Function ereg () is deprecated in drupal-6.15 \ Program des \ file. inc on line 904
Open the file. inc in a good text editor other than notepad, go to the line number 904 to see the following line. then comment the line and in the next line type the replaced code. this will solve the instalation issues and also most of other issues related to the same issue.

Change

Elseif ($ depth >=$ min_depth & ereg ($ mask, $ file )){

To
Elseif ($ depth >=$ min_depth & mb_ereg ($ mask, $ file )){

Mb_ereg fortunatly is not deprecated


PHP 5.4 was released, and he said his code reported an error:
"Call-time pass-by-reference has been removed"

Are you ready to upgrade to PHP 5.4?
This is the difference between the new version and the new version. The following sorting is based on the size of the impact on development.

========================================================== ======================
"Call-time pass-by-reference has been removed"
The reference transfer has been discarded during the call.
When we use a function (or class) like this, an error is generated:
Foo (& $ var );
In fact, this is an error, but the previous error level is only Deprecated.
The correct method of use should be when the function is defined:
Function foo (& $ var ){
}
The parameter can be directly transferred during the call: foo ($ var );

========================================================== ======================
Time zone (timezone) must be set
If you do not configure date. timezone in the configuration file or use date_default_timezone_set () in the code to set the time zone, some calculations will be made before, and this feature will be deleted after 5.4. Instead, the UTC time is used. (Click to view what is "UTF time ")

========================================================== ======================
E_ALL now contains E_STRICT
As we all know, E_STRICT is not included in E_ALL, so we can write E_ALL & E_STRICT.
In PHP 5.4, E_ALL will include E_STRICT.

========================================================== ======================
Register_globals removed
It is believed that many PHP versions are absolutely evil to register_globals, and register_globals is also considered to be the first of all evil. As early as 4.2, register_globals was disabled by default, and then merged and register_globals were removed by 5.4. One Less Thing to Worry About.

========================================================== ======================
Default character set to UTF-8
The default_charset in the configuration file changes from the original ISO-8859-1 to the UTF-8.

========================================================== ======================
Session_is_registered (), session_register (), and session_unregister () functions are removed.
These functions have been deprecated in PHP 5.3. If you want to use them, you can directly use isset () and unset () methods for the $ _ SESSION variable. After these methods are removed, an error occurs if they are used.

========================================================== ======================
Magic_quotes_gpc and all related functions and settings in ini
The magic_quotes_gpc, magic_quotes_runtime, and magic_quotes_sybase parameters are removed. While get_magic_quotes_gpc and get_magic_quotes_runtime are retained, but false is always returned. The set_magic_quotes_runtime will produce the E_CORE_ERROR error.

========================================================== ======================
EXT/SQLITE extension removed
Don't be surprised. The extension removed this time is only ext/sqlite, andExt/sqlite3And ext/pdo_sqlite are not removed.

The above is worth noting in this new version. The full version is available below, but it is changing at any time. You may have read this article before, but it is not the beginning of this article.
Http://php.net/ChangeLog-5.php




Performance Comparison Between php5.2X and php5.4x:

Hardware environment:

Server: DL180G6 (16 Intel (R) Xeon (R) CPU E5620 @ 2.40 GHz) 16 GB memory

Press: DL180G6 (16 Intel (R) Xeon (R) CPU E5620 @ 2.40 GHz) 16 GB memory

Software environment:

Nginx1.2.5php5.4.9/5.2.16 XCache3.0.0 Max 600php-fpm

Network Environment: Gigabit

Test scenario:

Php has two different versions. When the same hardware and network environment and pressure are configured, the same number of concurrent users send requests to the server. Compare the server resource usage and transaction processing capabilities.

Test results:

Concurrent users

CPU (us + sy)

Load average

Response time (s)

QPS/s

20

46%

9.2

0.022

950

40

49%

13.4

0.032

890

60

52%

22.8

0.043

860

80

54%

28.3

0.055

840

100

55%

42.1

0.064

820

PHP 5.2.16

Concurrent users

CPU (us + sy)

Load average

Response time (s)

QPS/s

20

48%

8.7

0.018

1100

40

50%

14.6

0.026

1050

60

54%

21.3

0.036

1010

80

56%

26.3

0.046

998

100

57%

34.7

0.054

1020

PHP 5.4.9

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.