PHP Ubuntu Server Setup method

Source: Internet
Author: User
API Server Femdom

Chinese language Femdom

sudo apt-get install Language-pack-zh-hanssudo vim/etc/default/locale# Vim/etc/default/locale Enter the following content lang= "En_US. UTF-8 "language=" Zh_cn.utf8 "lc_all=" Zh_cn.utf8 "

Install PHP

sudo apt-get install-y software-properties-common python-software-propertiessudo add-apt-repository ppa:ondrej/ Phpsudo apt-get updatesudo apt-get install-y php7.1 php7.1-mysql php7.1-curl php7.1-mbstring php7.1-gd php7.1-xml php7.1- Soap Php-pear Php7.1-dev Php7.1-zip php7.1-fpm

7.2 There is a problem: Warning:ini_set (): Headers already sent. You cannot change the session module ' s INI settings in this time in/home/cpc-api/library/zend/session.php on line 205

sudo apt-get install-y php7.2 php7.2-mysql php7.2-curl php7.2-mbstring php7.2-gd php7.2-xml php7.2-soap php-pear php7.2-d EV Php7.2-zip

sudo apt-get remove "php7.2*"

Installing Nginx

Reference: http://nginx.org/en/linux_packages.html

wget http://nginx.org/keys/nginx_signing.keysudo apt-key Add Nginx_signing.keysudo vim/etc/apt/sources.list####### Add the following content ######### #deb http://nginx.org/packages/ubuntu/xenial nginx     # 16.04 is xenial, Other versions of Ubuntu self-view replacement xenialdeb-src http://nginx.org/packages/ubuntu/xenial Nginx # 16.04 is xenial, other versions of Ubuntu self-view replacement xenial
sudo apt-get updatesudo apt-get install Nginx

installing MySQL 5.7

wget Https://dev.mysql.com/get/mysql-apt-config_0.8.9-1_all.debsudo dpkg-i Mysql-apt-config_0.8.9-1_all.debsudo Apt-get update sudo apt-get install Mysql-serversudo service MySQL stop

Installing MongoDB

sudo apt-get install MongoDB

Install PHP MongoDB Extension

sudo apt-get install pkg-configsudo pecl install MongoDB  # If prompted with an error, try sudo apt-get remove "php7.2*"

Apache2/php.ini Fpm/php.ini Cli/php.ini

Add extension=mongodb.so in PHP.ini

echo "extension=mongodb.so" >>/etc/php/7.1/apache/php.inisudo echo "extension=mongodb.so" >>/etc/php/ 7.1/cli/php.ini sudo echo "extension=mongodb.so" >>/etc/php/7.1/cli/php.ini

Modify an issue that is prone to memory overflow php.ini

Modify pcre.recursion_limit=5000

php.ini file Adjustment

Max_input_vars = 20000

Post_max_size = 50M

Modify/etc/php/7.1/fpm/php-fpm.conf

Emergency_restart_threshold = 10
Emergency_restart_interval = 1m

Modify the www file in php-fpm pool.d

Listen = 127.0.0.1:9000
Listen.allowed_clients = 127.0.0.1
Pm.max_children = 51
Pm.start_servers = 3
Pm.min_spare_servers = 2
Pm.max_spare_servers = 4
pm.max_requests = 1000

Slowlog =/var/log/$pool. Log.slow
Request_slowlog_timeout = 5s

Restart Nginx or Apache and FPM

Other software

sudo apt-get install-y git tig tree zsh nload Tmux

Installing OH-MY-ZSH

Sh-c "$ (curl-fssl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

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.