has been in the use of LNMP integrated installation package to build LNMP environment, because the work needs to install the LDAP extension, in the Internet can not find the source installation package, can only uninstall the original LNMP environment, with Ubuntu Php5-ldap extension,
In the installation encountered some problems, online articles of the pit Father more, write an article record down.
1. Install MySQL
sudo apt-get install mysql-server Mysql-clien
Enter the password of the root user during the installation process.
I was in the installation error, is the original mysql-cilent Mysql-workbench not completely uninstalled, the MySQL component completely uninstalled method:
Remove MySQL before deleting/var/lib/mysql and/etc/mysql.
sudo rm/var/lib/mysql/-r sudo rm/etc/mysql/-r sudo apt-get autoremove mysql*--purge sudo apt-get remove AppArmor
Remove all and then execute apt-get install Mysql-server mysql-client
2. Installing Nginx
sudo apt-get install Nginx
3. After the installation is successful. We re-start the Nginx service
sudo service nginx restart
After the launch we can access our address below. See if there is an nginx welcome screen.
4. Here we use PHP5-FPM as our PHP parsing.
sudo apt-get install PHP5-FPM
5. Next we will modify the Nginx site configuration.
The Ngnix configuration file is stored in the /etc/nginx/sites-availble/default
server { listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default ipv6only=on; ## listen for ipv6 root /usr/share/nginx/www; index index.php index.html index.htm; # make site accessible from http://localhost/ server_name _; location / { # first attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } location /doc { root /usr/share; autoindex on; allow 127.0.0.1 ; deny all; } #error_page 404 /404. Html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx /www; } # proxy the php scripts to Apache listening on 127.0.0.1:80 # # location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # location ~ \.php$ { try_ files $uri =404; # With php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # With php5-fpm: # fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if apache ' s Document root # concurs with nginx ' s one # location ~ /\.ht { &nBsp; deny all; } }
6. We are installing some components related to PHP5.
sudo apt-cache search php5 apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap PHP5-MCR Ypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
7. Restart the service
sudo service php5-fpm Restart sudo service nginx restart
after testing, it should be installed successfully.
The way PHP extensions are installed is usually divided into two types:
1.compile with PHP
2.generate a separate. so file
The second approach is described here, which may be less efficient for the second approach, but modular, that is, the ability to keep the PHP installation intact, extending through the php.ini connection to a separate so file,
For example, if you have already installed PHP with the TAR package, you now want to increase the extension:
Installing the Curl Extension
I. Generate a dynamic link library file. So
Here's how:
Method 1. Apt-get Install Php5-curl
Method 2. Go to the PHP Web site to download the tar package, phpize local build.
Method 3. Pear mode installation, through the pecl command to download the compilation generated online.
Method 1 is the simplest under Ubuntu, which tells you when the command is complete. So directory
II. Configuring PHP.ini
Open PHP.ini, specify the Extension_dir directory, and if Extension_dir = '/usr/lib ', then copy the resulting. So file (such as curl.so) to the/usr/lib directory and add a new entry:
Extension=curl.so
III. Making it effective
Restart Apache, run phpinfo () to see if it takes effect
Installing the Pdo_mysql Extension
Installation with Pear method
I. Installing the Pear
Apt-get Install Php-pear If you don't have pear, you'll need to set up pear
II. Installing the Pdo,pdo_mysql
PECL Install PDO pecl install Pdo_mysql
Generate. So to replicate to the/usr/lib directory.
If you do not have a PHP and MySQL development package installed, you will need to install it before Step II
Apt-get Install Php5-devapt-get Install Libmysqlclient15-dev
Iii. Modifying the configuration file php.ini
Add entry
Extension=pdo.so
Extension=pdo_mysql.so
Iv. making it effective
Restart Apache, run phpinfo () to see if it takes effect
In php5.2.10, PHP has already installed the PDO by default, so extension=pdo.so does not add, but finds that it does not match its own generated pdo_mysql.so error, the solution is:
Reinstall PHP, add parameters--disable-pdo prohibit PDO module, with your own front generated pdo.so,pdo+mysql.so is OK
Installing the Imagemagic Extension
Installation with Pear method
I. Installing the ImageMagick
sudo apt-get install ImageMagick
II. Installing the ImageMagick lib for PHP calls
sudo apt-get install Libmagick++-dev
III. Call the current PECL installation Imagick
PECL Install Imagick
Iv. modifying php.ini. Restarting the Apache server
Added in php.ini: extension = imagick.so
Installation of Phpize
Phpize is a content that belongs to Php-devel, so just run
Apt-get install Php-devel on the line. Under Ubuntu is apt-get install Php-dev
When I installed it, it was php5-dev.
After loading, I used phpize5 to install the PHP extension that I wrote.
Ubuntu builds LNMP environment and PHP extension installation by Apt-get Way