Replace XAMPP with Lnmp__linux under Linux Ubuntu

Source: Internet
Author: User
Tags curl fpm gettext install php mcrypt memcached oauth nginx server
Nothing's been going on for a while this weekend nginx

Reference: http://my.oschina.net/jiec/blog/295369

Note: Installing php5.6+ may require changes to fpm.conf configuration

SOURCE list: Http://wiki.ubuntu.org.cn/Qref/Source
1. Delete xampp folder

sudo mv/opt/lampp/home


2. Update Source

sudo apt-get install update


3. Install Nginx

sudo apt-get install Nginx


If you install Apache

sudo apt-get install apache2 Apache2-doc

sudo apt-get install php5 libapache2-mod-php5

4. Test Nginx

Sudo/etc/init.d/nginx start
Visit 127.0.0.1 => Welcome to Nginx


5. install MySQL

Uninstall mysql:http://www.cnblogs.com/steven_oyj/archive/2010/05/24/1742808.html


1. sudo apt-get install Mysql-server
2. sudo apt-get install mysql-client
3. sudo apt-get install Libmysqlclient-dev

Test sudo mysql-uroot-p

DPKG: Error processing Mysql-server (--configure):
Dependency issues-Still not configured

Encountered problem: E:sub-process/usr/bin/dpkg returned an error code (1)

Solve:

Scenario 1-Parental test is not valid

Before you delete MySQL, you need to remove/var/lib/mysql and/etc/mysql.

Programme 2
1.$ sudo mv/var/lib/dpkg/info/var/lib/dpkg/info_old//now rename the info folder
2.$ sudo mkdir/var/lib/dpkg/info//Then create a new info folder
3.$ sudo apt-get update, apt-get-f Install//no need to explain.
4.$ sudo mv/var/lib/dpkg/info/*/var/lib/dpkg/info_old//after performing the previous operation, the files are generated under the new Info folder, which is now moved all to the Info_old folder
5.$ sudo rm-rf/var/lib/dpkg/info//delete your new info folder
6.$ sudo mv/var/lib/dpkg/info_old/var/lib/dpkg/info//Change the previous Info folder back to the name

6. Install PHP

sudo apt-get install php5-fpm php5-mysql

Error: Apt-get install php5 times wrong: No packages are available, but it is referenced by other packages
Use sudo apt-cache search php to query the PHP version number in the Software warehouse, and then "sudo apt-get install php-query version number" to install.

7. Configure PHP, modify php.ini file

# Backup PHP.ini Files
Cp/etc/php5/fpm/php.ini/etc/php5/fpm/php.ini.back
# Remove the pathinfo pattern with security implications
Vim/etc/php5/fpm/php.ini
# set Cgi.fix_pathinfo=1 to Cgi.fix_pathinfo=0
Cgi.fix_pathinfo=0
#启动php-FPM
sudo service php5-fpm restart


8. Configure Nginx to use the PHP-FPM process

#备份/etc/nginx/sites-available/default File
Cp/etc/nginx/sites-available/default/etc/nginx/sites-available/default.back
#修改defalut文件内容如下--parental test

Line: "ROOT/HOME/XXX/XXX;"

Line 39:edit to "index index.html index.htm index.nginx-debian.html index.php;"

Line 51:location ~ \.php$ {//Remove comment

Line 52:include snippets/fastcgi-php.conf; Remove Comment

Line 57:fastcgi_pass Unix:/var/run/php5-fpm.sock; Remove Comment

Line//Remove comment


Report:

Can join the following

Location/{
#try_files $uri $uri/= 404;
if (!-e $request _filename) {
Rewrite/(. *?) $/index.php;
}
}

REDIRECT Add index.php


9. Restart Nginx Server

sudo service nginx restart

10. Create info.php in/home/xxx/xxx/to write the following

<?php
	phpinfo ();
? >
Browser input: http://localhost/info.php

11. Install PHP related extensions (Xdebug,memcache,oauth, etc.)

1) Install Curl
   sudo apt-get install php5-curl
 2) installation gettext:
   sudo apt-get install Php-gettext
 3) Install GD library:
   sudo apt-get install PHP5-GD
 4) installation mcrypt:
   sudo apt-get install php5-mcrypt
 5) installation memcache
   a) Install server:
     sudo Apt-get install memcached
     memcached-d-m 50-p 11211-u root
    -M Specifies how many megabytes of cache space (here)-p specifies the port to listen to (11211)-u specifies which user installs the PHP module using (root)
   b)
     sudo Apt-get install Php5-memcache
 6) installation OAuth: Pecl based
   a) sudo apt-get install Php5-dev php-pear Libpcre3-dev
     sudo pecl install OAuth (to ensure that Linux systems can make)
   B modifies the configuration file
     sudo vi/etc/php5/fpm/php.ini
     add last
?

1 Extension=oauth.so

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.