Aliyun 512 in-memory MySQL and PHP optimization settings

Source: Internet
Author: User
Tags install php aliyun


1, find the MySQL configuration file

/etc/my.cnf

I use the LNMP one-button installation package, MySQL configuration file may not be the same as yours, please find your own.

2, modify the following parameters:

Key_buffer = 16K
Max_allowed_packet = 1M
Thread_stack = 64K
Table_cache = 4
Sort_buffer = 64K
Net_buffer_length = 2K
If not, add it yourself.

3, if you do not use the InnoDB table, on the bottom of the file to disable InnoDB:

Skip-innodb

OK, then optimize the PHP settings.

After you install PHP, you need to turn on the log and adjust the settings to ensure better performance. Here, you need to focus on memory_limit this parameter, which controls how much memory is allocated to PHP. Here's how to enable logging and optimize PHP performance:

1, the first natural is to find the PHP configuration file:


/usr/local/php/etc/php.ini

2, to ensure that the following parameters have been set up, mainly to remove the previous annotation symbol ";"

Max_execution_time = 30
Memory_limit = 64M
error_reporting = e_compile_error| e_recoverable_error| e_error| E_core_error
Display_errors = Off
Log_errors = On
Error_log =/var/log/php.log
Register_globals = Off
Note: Here the 64M settings for most sites are applicable, if it is a larger site, you need to change to 128M or greater.

After saving the configuration file, restart the appropriate service

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.