How to accelerate your PHP Program

Source: Internet
Author: User

I always think that PHP runs very quickly, especially after Zend engine acceleration. But PHP still has the possibility of acceleration, you know?
Everything starts with how to optimize PHP compilation.

Try to use the special compilation parameter-msse-mmmx-mfpmath = sse for the CPU Model

Add the-03 parameter during compilation

Adjust the CPU parameter-march-mcpu Use Caution during compilation

Try to compile only the modules you need to avoid useless extension loading.

For extended modules that are rarely used, the shared mode should be compiled to facilitate dynamic loading during running.

Sometimes -- disable-all will be your best friend.

PHP static compilation to Apache can be accelerated by 20%

# PHP

./Configure -- with-apache =/path/to/apache_source

# Apache

./Configure -- activate-module = src/modules/php4/libphp4.a

Optimize Your PHP configuration file

Make sure your register_globals is configured as disabled

Disable magic_quotes _ *

Disable expose_php

Disable register_argc_argv

Unless absolutely required, do not enable always_populate_raw_post_data

Optimization Configuration of Apache server

Use high configuration for MaxSpareServers

Set MaxClients to 2/5 that your server can afford

MaxRequestsPerChild is ideally 0 (not limited), but is actually set to a larger value.

Optimize File Access

The DirectoryIndex file list is as short as possible.

No matter how you disable AllowOverridenone of the. htaccess File

Use FollowSymLinks to simplify File Access Processing

Avoid mod_rewrite or more complex operations

Disable logs if they are not required.

If logs must be used, record them to a file and clear them after analysis.

Eliminate expensive system calls

Do not enable ExtendedStatus

Use IP addresses instead of domain names when rules are allowed and prohibited

Do not enable HostnameLookups

Disable ServerSignature

Set KeepAlive to a smaller value.

Dynamic and Static content Separation

Improves hard disk Performance Parameters

Use output_buffering to optimize the interaction between PHP and Apache

Increase the SendBufferSize of Apache

Improve cache execution

Use PHP code caching mechanism

Turck MMCache stops development

APC is slow and not optimized enough

Zend Cache has good performance optimization but is charged

IonCube PHP Accelerator is free but not open-source

If you can use Zlib for compression

Reduce output data

Replacing HTML with CSS

Compressing HTML pages

Use Sessions Management

Optimize Your SQL commands

 

Related Article

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.