PHP configuration for the Ubuntu Apache service

Source: Internet
Author: User
Tags file upload ini php file

Update the Ubuntu system to the latest state and do this step before doing anything to ensure that the system is stable and there are no inexplicable phenomena.

$sudo apt-get Update

$sudo Apt-get Dist-upgrade

Installing PHP Support

$sudo Apt-get Install LIBAPACHE2-MOD-PHP5

$sudo Apt-get Install PHP5

If you want to support graphics add PHP5-GD, if you want to support MySQL add Php5-mysql, here is the reason to list libapache2-mod-php5, mainly because of php5 dependencies did not do a good job, It is possible to install LIBAPACHE-MOD-PHP4 packages, so it is better to simply specify them individually in order to avoid unnecessary hassles. If you have friends who still have problems, please find the LIBAPACHE-MOD-PHP4 package in the new stand, if you install it, please delete it.

Modify PHP configuration file to limit maximum memory and file upload size

We edit the/etc/php5/apache2/php.ini file, do the general configuration first, before making changes, please make a backup of the profile. So that you can recover when you make a mistake.

...

Memory_limit = = 8M ==> modified to the size of the memory you need

Upload_max_filesize = = 2M ==> modified file maximum upload size

...

extension=mysql.so Support MySQL Service

Extension=gd.so Support GD function

...

In fact, under Ubuntu, if you install the Php5-mysql and PHP5-GD, you will automatically modify the above two lines, we do is just to confirm that their previous annotation is removed.

A. Most of the current PHP open source is written in PhP4, in order to compatible with the previous PHP version, sometimes need to register_long_arrays open, otherwise $http_get_vars and $http_post_ VARs and other variables will not work, there will be some inexplicable problems. A. In addition, after loading php5, it is best to confirm whether there are links under/etc/apache2/mods-enabled/:

Php5.load->/etc/apache2/mods-available/php5.load

reinforce PHP to enhance security. Note that the security below depends on the situation, so I've already written down their functionality, and if there's a problem, see if any of the following restrictions are causing it to be commented out accordingly. So let's start, we will edit the/etc/php5/apache2/php.ini file again, the reason is not once changed, mainly to give you a clear idea.

#打开安全模式, open his advantage is that the PHP file can only access the owner and PHP files have the same file, even in the chroot environment can not access the jail in the main different files, similar to the PHP shell, such as the back door is useless oh, Phpshell is a popular PHP backdoor, he can execute system commands, just like his name, and Shell very close.

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.