Lnmp source code compilation and installation, common error sorting, lnmp Common Errors

Source: Internet
Author: User
Tags mcrypt

Lnmp source code compilation and installation, common error sorting, lnmp Common Errors


Introduction:

The establishment of the Lnmp environment is still very simple. Previously, due to blog migration and other reasons, many blog posts were lost. Record this time.

Lnmp: Linux, Nginx, Mysql, and PHP

Lnmp is a Web environment. Linux is the underlying operating system. Nginx provides web Services, Mysql provides database services, and PHP is responsible for parsing PHP code.

It is strongly recommended that the host machine memory be greater than or equal to 1 GB. Otherwise, we recommend that you install lower versions of Mysql and PHP !!!

I. Nginx

: Http://nginx.org/download/nginx-1.8.0.tar.gz # Now the latest stable version has been developed to 1.8.0

Shell> yum-y install gcc-c ++ make wget zlib-devel pcre-devel openssl-develshell> wget http://nginx.org/download/nginx-1.8.0.tar.gzshell> tar zxf nginx-1.8.0.tar.gzshell> cd nginx-1.8.0shell>. /configure -- prefix =/usr/local/nginx; make; make install # -- prefix parameter specifies Nginx installation path shell>/usr/local/nginx/sbin/nginx # Start Nginxshell> netstat-anpt | grep nginx # Check whether tcp 0 0 0.0.0.0 is enabled: 80 0.0.0.0: * LISTEN 7520/nginxshell> curl-I http: // 127.0.0.1 # successful access HTTP/1.1 200 OKServer: nginx/1.8.0Date: Fri, 07 Aug 2015 12:08:14 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Fri, 07 Aug 2015 12:04:38 GMTConnection: keep-aliveETag: "55c49ed6-264" Accept-Ranges: bytesshell> iptables-I INPUT-p tcp -- dport 80-j ACCEPTshell> service iptables save

# Nginx can be accessed through a browser over the Internet now

Ii. Mysql (Portal: http://www.cnblogs.com/wangxiaoqiangs/p/5336048.html)

Iii. PHP

: Http://cn2.php.net/distributions/php-5.6.11.tar.gz

shell > yum -y install epel-releaseshell > yum -y install gd-devel libtool libjpeg-devel libpng-devel freetype-devel libxml2-devel zlib-devel bzip2-devel libcurl-devel libxslt-devel openssl-devel glibc-devel glib2-devel libmcrypt-develshell > wget http://cn2.php.net/distributions/php-5.6.11.tar.gzshell > tar zxf php-5.6.11.tar.gzshell > cd php-5.6.11shell > ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php \--with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config \--with-gd --with-xsl --with-bz2 --with-zlib --with-curl --with-pear --without-iconv --with-mcrypt \--with-gettext --with-openssl --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir \--with-libdir=lib64 --enable-ftp --enable-fpm --enable-exif --enable-soap --enable-bcmath --enable-calendar \--enable-sockets --enable-mbstring --enable-gd-native-ttf --disable-rpath --disable-debug

# What do you do with these heap parameters? You don't have to worry too much about them. You can solve most of the requirements. Several explanations are needed.
# -- Prefix = Specify the installation path
# -- With-config-file-path specifies the storage location of php. ini
# -- With-mysql specifies the Mysql installation path
# -- Enable-fpm Nginx depends on php. Without it, your Nginx cannot parse php.

Shell & gt; make; installshell & gt; cp/usr/local/src/php-5.6.11/php. ini-production/usr/local/php. inishell> cp/usr/local/src/php-5.6.11/sapi/fpm/init. d. php-fpm/etc/init. d/php-fpmshell> chmod a + x/etc/init. d/php-fpmshell> cat/usr/local/php/etc/php-fpm.conf.default>/usr/local/php/etc/php-fpm.confshell> chkconfig -- add php-fpm # add boot start shell> chkconfig -- level 35 php-fpm onshell> service php-fpm start # start php-fpmshell> netstat-anpt | grep php-fpmtcp 0 0 127.0.0.1: 9000 0.0.0.0: * LISTEN 71992/php-fpm

4. Enable Nginx to support PHP

Shell> vim/usr/local/nginx/conf/nginx. conf # modify the configuration file so that it can parse PHPserver {listen 80; server_name localhost; location/{root html; index. php index.html index.htm; # add index. php} error_page 500 502 503 504/50 x.html; location =/50x.html {root html;} location ~ \. Php $ {# Remove root html; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME/usr/local/nginx/html $ fastcgi_script_name; # change to your own root directory include fastcgi_params ;}}

# Of course, this only enables Nginx to support PHP. More configurations are available in actual work.

# Create a test page (echo "<? Php phpinfo ();?> ">/Usr/local/nginx/html/info. php), restart Nginx and php-fpm for testing! (For a long time before testing, remember to use iptables-I input-I io-j ACCEPT)

V. Error Summary: (record some common errors and solutions)

1. If gcc is not installed, an error is reported (yum-y install gcc)

checking for OS+ Linux 2.6.32-504.el6.x86_64 x86_64checking for C compiler ... not found./configure: error: C compiler cc is not found

 

2. If pcre-devel is not installed, an error is returned (yum-y install pcre-devel)

./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_moduleoption, or install the PCRE library into the system, or build the PCRE librarystatically from the source with nginx by using --with-pcre=<path> option.

3. If zlib-devel is not installed, an error is returned (yum-y install zlib-devel)

./configure: error: the HTTP gzip module requires the zlib library.You can either disable the module by using --without-http_gzip_moduleoption, or install the zlib library into the system, or build the zlib librarystatically from the source with nginx by using --with-zlib=<path> option.

# Above is the error message about Nginx

4. If gcc-c ++ is not installed, an error is returned (yum-y install gcc-c ++)

CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

# Mysql Error

5. No libxml2-devel is installed causing an error (yum-y install libxml2-devel)

configure: error: xml2-config not found. Please check your libxml2 installation.

6. No bzip2-devel is installed, causing an error (yum-y install bzip2-devel)

configure: error: Please reinstall the BZip2 distribution

7. If libcurl-devel is not installed, an error is returned (yum-y install libcurl-devel)

configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/

8. If libjpeg-devel is not installed, an error is returned (yum-y install libjpeg-devel)

configure: error: jpeglib.h not found.

9. If libpng-devel is not installed, an error is returned (yum-y install libpng-devel)

configure: error: png.h not found.

10. If freetype-devel is not installed, an error is returned (yum-y install freetype-devel)

configure: error: freetype-config not found.

11. If libmcrypt-devel is not installed, an error is reported (yum-y install epel-release; yum-y install libmcrypt-devel)

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

12. If libmysqlclient. so.18 is not found, an error is returned (ln-s/usr/local/mysql/lib/usr/local/mysql/lib64)

configure: error: Cannot find libmysqlclient under /usr/local/mysql/.Note that the MySQL client library is not bundled anymore!

13. Keep up with an error. I guess (ln-s/usr/local/mysql/lib/libmysqlclient. so.18/usr/lib64 /)

configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no

14. If libxslt-devel is not installed, an error is reported (yum-y install libxslt-devel)

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

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.