1, in the case can be used file_get_contents alternative File,fopen,feof,fget series of methods, as far as possible to use the feil_get_contents, because it is much more efficient! But pay attention to the PHP version of file_get_contents when you
1. First we install the XHPROF:
Yum Install Xhprof
2. After installation, find xhprof configuration file xhprof.conf, usually in/ETC/PHP.D, add these 2 lines:
Extension=xhprof.soxhprof.output_dir=
This path refers to the folder
Generate test data with a probability of 1%, and try not to affect the efficiency of the formal environment.Class XHProf {// Private $ XHProfPath = 'xhprof /';Private $ XHProfPath = '/usr/local/apache/htdocs/xhprof /';Private $ applicationName =
PHP Optimization for PHP is mainly for PHP. the main parameters in ini are adjusted and set properly. Let's take a look at PhP below. how to set parameters that have a greater impact on performance in ini.
# Vi/etc/PHP. ini
(1) Disable finding
InCodeXdebug has been used for breakpoint debugging. I recently learned that xdebug can also perform Performance Analysis on PHP Web code. The following describes how to use it.
Download xdebug at http://www.xdebug.com/download.php. Note that
1. General hardware upgrade rules: For PHP scripts, the main bottleneck is CPU, and for static pages, the bottleneck is memory and network. The Static Page downloaded by a 400 MHz ordinary Pentium machine can make the T3 leased line (45 Mbps)
1. When file_get_contents can be used to replace file, fopen, feof, fgets, and other methods, use file_get_contents as much as possible because of its high efficiency! Note the PHP version of file_get_contents when opening a URL file;
2. Perform as
What is PEAR?
PEAR is the abbreviation of the PHP Extension and Application Repository. It is a code repository for PHP extensions and applications. In short, PEAR is the CPAN of PHP.
Why is PEAR installed?
PEAR provides a wide range of PHP
I. installation and configuration
1. Download PHP XDebug extension, URL: http://xdebug.org/
2. Compile and install XDebug in Linux
ReferenceTar-xzf xdebug-2.0.0RC3.gzCd xdebug-2.0.0RC3/Usr/local/php/bin/phpize./Configure -- enable-xdebugCp
PHP Optimization for PHP is mainly for php. the main parameters in ini are adjusted and set properly. Let's take a look at php below. how to set parameters that have a greater impact on performance in ini.
# Vi/etc/php. ini
(1) Disable finding PHP
However, when the database you are using is located on a different computer from the Web server, it is always a good way to cache the database result set. However, it is difficult to determine the best cache policy based on your situation. For
Build a client Now, you haveThe table has been created for registration. Next we will learn how to use the change notification for the client applications that access the orders stored in these tables and their order items. To this end, you can
Test data:There is an array with a total of 30 thousand pieces of data, 1 MB. I divided it into two ways to test the data.1. Create an empty PHP file in array. php and put the array in. 2. array.txt Save the array serialize
123
for ($i=0
Accelerator to participate in the test: XCACHE,OPCACHE,HHVMXCache IntroductionThe principles and functions of the PHP accelerator (see PHP-FPM server for Lamp architecture ) are described earlier, and XCache, as one of the most widely used PHP
Recently in the company while writing a PHP program, because the company's operating efficiency requirements of the program is very high, but also a novice, the first attention to the efficiency of the program is very important, here on the
As we all know, MySQL has slow query log, and we can tell that those SQL statements have performance problems based on the slow search logs. As a good partner for MySQL, PHP has the same functionality. If you use PHP-FPM to manage PHP, you can open
Problems
Call the Xhprof_enable method multiple times, which is the last configuration that takes effect?When you call the Xhprof_enable method more than once in a request, only the settings that are made when the first call takes effect. In the
1, can use file_get_contents instead of file, fopen, feof, Fgets, and other series of methods, as far as possible with file_get_contents, because his efficiency is much higher! But pay attention to file_get_contents in opening a URL file when the
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.