Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing Nginx, mysql and php with centos5 source code

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "centos5 source code installation of Nginx, mysql and php method", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "centos5 source code installation of Nginx, mysql and php method"!

The system I installed: Centos5

1. Download

The download I installed comes from Zhang Xianbo's address, and the download is saved in a folder of my own directory under home:

The code is as follows:

Cd / home/xuxx/software

Wget http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.7.51.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.8.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.8-fpm-0.5.10.diff.gz

Wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.1.33.zip

Wget http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgz

Wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-7.8.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.5.3.tar.bz2

Wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz

Wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz

Wget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.2.2.tgz

2. When you are ready to compile the installation environment, you need to compile the source code using gc++

It is recommended that if it is a newly installed system, use yum upgrade to update the system.

The code is as follows:

Sudo-s

LANG=C

Yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel

Glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel

Openldap openldap-devel nss_ldap openldap-clients openldap-servers

Note: all commands here are on one line and cannot have newline characters. If it is copy, be careful to place the newline character.

Make sure the installation is successful! To use compilation correctly.

3. Install:

First, install PHP 5.2.8 (FastCGI mode)

1. Compile and install the required libraries for PHP 5.2.8:

1] libiconv library

The code is as follows:

Tar zxvf libiconv-1.13.tar.gz

Cd libiconv-1.13/

. / configure-- prefix=/usr/local

Make

Make install

Make clean

> make distclean

Cd.. /

Both make clean and make distclean delete cache files generated during installation. Of course, you can skip these two steps of cleaning if you don't mind leaving it.

2] libmcrypt library

The code is as follows:

Tar zxvf libmcrypt-2.5.8.tar.gz

Cd libmcrypt-2.5.8/

. / configure

Make

Make install

Make clean

Make distclean

/ sbin/ldconfig

Cd libltdl/

. / configure-- enable-ltdl-install

Make

Make install

Make clean

Make distclean

Cd http://www.cnblogs.com/

3] mhash library

The code is as follows:

Tar zxvf mhash-0.9.9.9.tar.gz

Cd mhash-0.9.9.9/

. / configure

Make

Make install

Cd.. /

4] mcrypt library

Note: because the library is dependent on libmcrypt, you must know libmcrypt before installation, otherwise it will appear:

Error

The code is as follows:

Checking for libmcrypt-version > = 2.5.0...

* * 'libmcrypt-config-version' returned 2.4.0, but LIBMCRYPT (2.5.8)

* was found! If libmcrypt-config was correct, then it is best

* to remove the old version of LIBMCRYPT. You may also be able to fix the error

* by modifying your LD_LIBRARY_PATH enviroment variable, or by editing

* / etc/ld.so.conf. Make sure you have run ldconfig if that is

* required on your system.

* If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG

* to point to the correct copy of libmcrypt-config, and remove the file config.cache

* before re-running configure

Configure: error: * * libmcrypt was not found

Because of a problem with path, execute:

The code is as follows:

Ln-s / usr/local/lib/libmcrypt.la / usr/lib/libmcrypt.la

Ln-s / usr/local/lib/libmcrypt.so / usr/lib/libmcrypt.so

Ln-s / usr/local/lib/libmcrypt.so.4 / usr/lib/libmcrypt.so.4

Ln-s / usr/local/lib/libmcrypt.so.4.4.8 / usr/lib/libmcrypt.so.4.4.8

Ln-s / usr/local/lib/libmhash.a / usr/lib/libmhash.a

Ln-s / usr/local/lib/libmhash.la / usr/lib/libmhash.la

Ln-s / usr/local/lib/libmhash.so / usr/lib/libmhash.so

Ln-s / usr/local/lib/libmhash.so.2 / usr/lib/libmhash.so.2

Ln-s / usr/local/lib/libmhash.so.2.0.1 / usr/lib/libmhash.so.2.0.1

Ln-s / usr/local/bin/libmcrypt-config / usr/bin/libmcrypt-config

Then install:

The code is as follows:

Tar zxvf mcrypt-2.6.8.tar.gz

Cd mcrypt-2.6.8/

/ sbin/ldconfig

. / configure

Make

Make install

Cd.. /

Second, install mysql

The code is as follows:

/ usr/sbin/groupadd mysql

/ usr/sbin/useradd-g mysql xxx

Unzip mysql-5.1.33.zip

Cd mysql-5.1.33/

. / configure-prefix=/usr/local/webserver/mysql/-enable-assembler-with-extra-charsets=complex-enable-thread-safe-client-with-big-tables

-with-readline-- with-ssl-- with-embedded-server-- enable-local-infile-- with-plugins=innobase

Make

Make install

Make clean

Make distclean

Chmod + w / usr/local/webserver/mysql

Chown-R xxx:mysql / usr/local/webserver/mysql

Cp support-files/my-medium.cnf.sh / usr/local/webserver/mysql/my.cnf

Cd.. /

Note: the compiled. / configure command here is on one line and cannot have a newline character. If it is copy, be careful to place the newline character.

In the last step of copying, I finished installing that there was no my-medium.cnf but only my-medium.cnf.sh under support-files, so I copied this file over.

@ original text of Zhang Banquet:

Attachment: the following are additional steps. If you want to run the MySQL database on this server, perform the following two steps. If you just want PHP to support MySQL extension libraries and be able to connect to MySQL databases on other servers, you don't need to perform the following two steps.

①, create a data sheet as a xxx user account:

The code is as follows:

/ usr/local/webserver/mysql/bin/mysql_install_db-basedir=/usr/local/webserver/mysql-datadir=/usr/local/webserver/mysql/data-user=xxx

②, start MySQL (the last & means to run in the background)

The code is as follows:

/ bin/sh / usr/local/webserver/mysql/bin/mysqld_safe-- defaults-file=/usr/local/webserver/mysql/my.cnf &

3. Compile and install PHP (FastCGI mode)

The code is as follows:

Tar zxvf php-5.2.8.tar.gz

Gzip-cd php-5.2.8-fpm-0.5.10.diff.gz | patch-d php-5.2.8- p1

Cd php-5.2.8/

. / configure-- prefix=/usr/local/webserver/php-- with-config-file-path=/usr/local/webserver/php/etc-- with-mysql=/usr/local/webserver/mysql

-with-mysqli=/usr/local/webserver/mysql/bin/mysql_config-- with-iconv-dir=/usr/local-- with-freetype-dir-- with-jpeg-dir-- with-png-dir-- with-zlib

-with-libxml-dir=/usr-- enable-xml-- disable-rpath-- enable-discard-path-- enable-safe-mode-- enable-bcmath-- enable-shmop-- enable-sysvsem

-enable-inline-optimization-with-curl-with-curlwrappers-enable-mbregex-enable-fastcgi-enable-fpm-enable-force-cgi-redirect

-- enable-mbstring-- with-mcrypt-- with-gd-- enable-gd-native-ttf-- with-openssl-- with-mhash-- enable-pcntl-- enable-sockets-- with-ldap

-- with-ldap-sasl

Make ZEND_EXTRA_LIBS='-liconv'

Make install

Cp php.ini-dist / usr/local/webserver/php/etc/php.ini

Cd.. /

Note: here the. / configure command is on one line and cannot have a newline character. If it is copy, be careful to go to the newline character.

4. Compile and install PHP5 extension module-optional installation

The code is as follows:

Tar zxvf memcache-2.2.5.tgz

Cd memcache-2.2.5/

/ usr/local/webserver/php/bin/phpize

. / configure-- with-php-config=/usr/local/webserver/php/bin/php-config

Make

Make install

Make clean

Make distclean

Cd.. /

Tar jxvf eaccelerator-0.9.5.3.tar.bz2

Cd eaccelerator-0.9.5.3/

/ usr/local/webserver/php/bin/phpize

. / configure-enable-eaccelerator=shared-with-php-config=/usr/local/webserver/php/bin/php-config

Make

Make install

Make clean

Make distclean

Cd.. /

Tar zxvf PDO_MYSQL-1.0.2.tgz

Cd PDO_MYSQL-1.0.2/

/ usr/local/webserver/php/bin/phpize

. / configure-with-php-config=/usr/local/webserver/php/bin/php-config-with-pdo-mysql=/usr/local/webserver/mysql

Make

Make install

Make clean

Make distclean

Cd.. /

Tar zxvf ImageMagick.tar.gz

Cd ImageMagick-6.5.1-2 /

. / configure

Make

Make install

Make clean

Make distclean

Cd.. /

Tar zxvf imagick-2.2.2.tgz

Cd imagick-2.2.2/

/ usr/local/webserver/php/bin/phpize

. / configure-- with-php-config=/usr/local/webserver/php/bin/php-config

Make

Make install

Make clean

Make distclean

Cd.. /

5. Modify php.ini file

Manual modification: find extension_dir = ". /" in / usr/local/webserver/php/etc/php.ini

Change to extension_dir = "/ usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"

Add the following lines after this line, and then save:

Extension = "memcache.so"

Extension = "pdo_mysql.so"

Extension = "imagick.so"

Then look for output_buffering = Off

Modified to output_buffering = On

6. Configure eAccelerator acceleration PHP:

Mkdir-p / usr/local/webserver/eaccelerator_cache

Vi / usr/local/webserver/php/etc/php.ini

Press shift+g to skip to the end of the configuration file, plus the following configuration information:

The code is as follows:

[eaccelerator]

Zend_extension= "/ usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"

Eaccelerator.shm_size= "128"

Eaccelerator.cache_dir= "/ usr/local/webserver/eaccelerator_cache"

Eaccelerator.enable= "1"

Eaccelerator.optimizer= "1"

Eaccelerator.check_mtime= "1"

Eaccelerator.debug= "0"

Eaccelerator.filter= ""

Eaccelerator.shm_max= "0"

Eaccelerator.shm_ttl= "300"

Eaccelerator.shm_prune_period= "120s"

Eaccelerator.shm_only= "0"

Eaccelerator.compress= "1"

Eaccelerator.compress_level= "9"

Modify the configuration file:

Vi / etc/sysctl.conf

Kernel.shmmax = 134217728

Then execute the following command to make the configuration effective: / sbin/sysctl-p

Thank you for reading, the above is the "centos5 source installation of Nginx, mysql and php method" of the content, after the study of this article, I believe you on the centos5 source installation of Nginx, mysql and php method of this problem has a deeper understanding, the specific use of the need for you to practice verification. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report