Deploy the php test environment on the ubuntu machine, and deploy php on the ubuntu machine. Deploy the php test environment on the ubuntu machine. deploy php on the ubuntu machine to deploy the php test environment I. deploy the environment Ubuntu11.10 _ X86_32 and compile and install the corresponding software: nginx + deploy the php test environment on ubuntu Machines, and deploy php on ubuntu Machines
Deploy the php test environment on ubuntu Machine 1. deploy the environment
Ubuntu11.10 _ X86_32. Compile and install the appropriate software: nginx + mysql + php.
II. software installation 2.1 Software Download
Libiconv-1.14.tar.gz
Libmcrypt-2.5.7.tar.gz
Mcrypt-2.6.8.gz
Mhash-0.9.9.9.tar.gz
Mysql-5.5.39.tar.gz
Nginx-1.1.10.tar.gz
Pcre-8.20.tar.gz
Php-5.4.34.tar.gz
2.2 Environment configuration
The system is relatively pure. install necessary tools and software.
Apt-get install gcc g ++ ssh automake cmake build-essential autoconf make re2c wget cron bzip2 rcconf flex vim bison m4 mawk cpp binutils libncurses5 unzip tar libncurses5 libncurses5-dev libtool pclibre3 libssl-dev zlibc openssl libxml2-dev libltdl3-dev libpcre3 libpcrecpp0 libssl-dev zlibc openssl libxml2-dev libltdl3-dev libmcrypt-dev
2.3 auxiliary software installation 2.3.1 libiconv-1.14.tar.gz
Tar zxvf libiconv-1.14.tar.gz
Cd libiconv-1.14/
Cd libiconv-1.14/
./Configure -- prefix =/usr/local
Make
Make install
2.3.2 mhash-0.9.9.9.tar.gz
Tar zxvf mhash-0.9.9.9.tar.gz
Cd mhash-0.9.9.9
./Configure
Make
Make install
Cd ../
2.3.3 libmcrypt-2.5.8.tar.gz
Tar zxvf libmcrypt-2.5.8.tar.gz
Cd libmcrypt-2.5.8/
./Configure
Make
Make install
/Sbin/ldconfig
Cd libltdl/
./Configure -- enable-ltdl-install
Make
Make install
2.3.4 mcrypt-2.6.8.tar.gz
Tar zxvf mcrypt-2.6.8.tar.gz
Cd mcrypt-2.6.8/
/Sbin/ldconfig
./Configure
Make
Make install
2.3.5 pcre-8.10.tar.gz
Tar zxvf pcre-8.10.tar.gz
Cd pcre-8.10
./Configure
Make
Make install
2.4 install mysql
Groupadd mysql # Add a mysql Group
Useradd-g mysql-s/bin/false # Create a user mysql and add it to the mysql group. mysql users are not allowed to log on directly to the system.
Mkdir-p/data/mysql # Create a directory for storing MySQL databases
Chown-R mysql: mysql/data/mysql # set MySQL database directory permissions
Tar zxvf mysql-5.5.19.tar.gz
Cd mysql-5.5.19
Mkdir-p/usr/local/mysql # create the MySQL installation directory
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8-unicode_ci-rows =/usr/local/mysql/data-rows = 1-rows = 1-DEXTRA_CHARSETS = all-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DSYSCONFDIR =/etc-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock-dmysql _tcp_port = 3306
Make
Make install
Cp support-files/my-small.cnf/etc/my. cnf
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql
Cd/usr/local/mysql
Cp./support-files/my-huge.cnf/etc/my. cnf # Copy the configuration file (Note: Under the/etc directory there is a default my. cnf, directly overwrite it)
Vi/etc/my. cnf # Edit the configuration file and add it in [mysqld ].
Datadir =/data/mysql # add the MySQL database path
./Scripts/mysql_install_db -- user = mysql # generate a mysql system database
Cp./support-files/mysql. server/etc/rc. d/init. d/mysqld # Add Mysql to the system to start
Chmod 755/etc/init. d/mysqld # Add execution permission
Start: bin/mysqld_safe-user = mysql &
Ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
Ln-s/usr/local/mysql/include/mysql/usr/include/mysql
Change password/usr/local/mysql/bin/mysqladmin-u root-p password "123456"
Error1:
Solution:
2.5 install php
Apt-get install libfreetype6-dev libjpeg8-dev libpng12-dev slapd ldap-utils db5.1-util
Apt-get install libldap2-dev libsasl2-dev
. /Configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-mysql =/usr/local/mysql -- with-mysqli =/usr/local/mysql/bin/mysql_config -- with-iconv-dir =/usr/local -- with-freetype-dir -- with-jpeg-dir --- 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 -- -ldap -- with-ldap-sasl -- with-xmlrpc -- enable-zip -- enable-soap -- disable-maintainer-zts
Error 1:Configure: error: Please reinstall the libcurl distribution-easy. h shoshould be in/include/curl/
Solution:Apt-get install curl
Apt-get install libcurl4-gnutls-dev
Apt-get install php5-curl
Error 2:Ldap not found
Solution:Delete ---- with-ldap in configuration information
Make ZEND_EXTRA_LIBS = '-liconv'
Make test
Make install
Cp php. ini-production/usr/local/php/etc/php. ini
Run the following command to view the PHP configuration and obtain the extension-dir Directory of the PHP extension:/usr/local/php/bin/php-config
The extension_dir = information is displayed here // http://www.pprar.com
Vi/usr/local/php/etc/php. ini
Modify: extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626 /"
Create fastcgi configuration file
Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
Modify fastcgi configuration file
6/usr/local/php/etc/php-fpm.conf
Remove comments for the following lines
Pid = run/php-fpm.pid
Error_log = log/php-fpm.log
Log_level = notice
Pm. start_servers
Pm. min_spare_servers
Pm. max_spare_servers
Modify the following two lines of the file. if fastcgi is enabled without modification, the error "fastcgi [pool www] cannot get gid for group 'nobody'" will be reported '"
User = nobody
Group = nobody
Change
User = www
Group = www
Error 1:"Fastcgi [pool www] cannot get gid for group 'WWW '"
Solution:Create users and groups by yourself
Sudo useradd www
Start fastcgi
/Usr/local/php/sbin/php-fpm
Error2:ERROR: unable to bind listening socket for address '2017. 0.0.1: 100': Address already in use (98)
ERROR: FPM initialization failed
Solution:Netstat-lntup | grep 9000
Killall php-fpm
Error3:Couldn't load module:/usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so:/usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: cannot open shared object file: No such file or directory
Solution:1) install getlibs
Download: getlibs-all.deb
Run: sudo dpkg-I -- force-all getlibs-all.deb
Sudo apt-get update getlibs aapt
2) install the 32-bit Library
Getlibs-p gnome-keyring: i386
3) generate symbolic links
Sudo ln-s/usr/lib32/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so
2.6 install Nginx
Tar zxvf nginx-1.1.10.tar.gz
Cd nginx-1.1.10/
./Configure -- user = www -- group = www -- prefix =/usr/local/nginx -- with-http_stub_status_module
Make
Make install
Start Nginx
/Usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx. conf
Restart the service:/usr/local/nginx/sbin/nginx
Stop Service: killall nginx
3. application deployment 3.1 environment deployment
Vi/usr/local/nginx/conf/nginx. conf
Add
Server {
Listen 7070; # Internet access port number
Server_name blue-desk.com.cn;
Location /{
Root/usr/local/src/wwwroot; # address of the application
Index index.html index.htm I index. php;
}
Error_page 500 502 503 x.html;
Location =/50x.html {
Root html;
}
Location ~ \. Php $ {
Root/usr/local/src/wwwroot; # address of the application
Fastcgi_pass 10.128.7.101: 9000; # port number associated with php-fpm, php-fpm configuration in/usr/local/php/etc/php-fpm.conf
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/usr/local/src/wwwroot $ fastcgi_script_name; #/usr/local/src/wwwroot application address
Include fastcgi_params;
}
}
3.2 configure the application
Onethink application configuration
Database name: mysql
Username: root
Database password: 123456
Deployment: deploy the php test environment on ubuntu Machine 1. deploy the environment Ubuntu11.10 _ X86_32, compile and install the corresponding software: nginx +...