Table of Contents
2.3.1 libiconv-1.14.tar.gz
2.3.2 mhash-0.9.9.9.tar.gz
2.3.3 libmcrypt-2.5.8.tar.gz
2.3.4 mcrypt-2.6.8.tar.gz
2.3.5 pcre-8.10.tar.gz
Home Backend Development PHP Tutorial Deploy php test environment on ubuntu machine

Deploy php test environment on ubuntu machine

Aug 08, 2016 am 09:30 AM
mysql nbsp php usr

Deploy php test environment on ubuntu machine

1. Deployment environment

Ubuntu11.10_X86_32, compile and install the corresponding software: nginx+mysql+php.

2. 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 clean and some necessary software tools need to be installed

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-dev libtool libpcre3 libpcrecpp0 libssl-dev zlibc openssl libxml2-dev libltd l3-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 mysql group

useradd -g mysql mysql -s /bin/false #Create user mysql and add it to the mysql group. Mysql users are not allowed to log in to the system directly

mkdir -p /data/mysql #Create MySQL database storage directory

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 MySQL installation directory

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8-unicode_ci -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHAR SETS=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: there is a my.cnf under the /etc directory by default, just overwrite it directly)

vi /etc/my.cnf #Edit the configuration file and add

to the [mysqld] section

datadir = /data/mysql #Add MySQL database path

./scripts/mysql_install_db --user=mysql #Generate 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 #Increase execution permissions

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"

Error 1:

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 --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 --with-xmlrpc - -enable-zip --enable-soap --disable-maintainer-zts

Error 1: configure: error: Please reinstall the libcurl distribution - easy.h should 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 the configuration information

make ZEND_EXTRA_LIBS='-liconv'

make test

make install

cp php.ini-production /usr/local/php/etc/php.ini

Execute the command to view the PHP related configuration and obtain the extension-dir value of the PHP extension storage directory: /usr/local/php/bin/php-config

The information of extension_dir = 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

vi /usr/local/php/etc/php-fpm.conf

Uncomment 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 you start fastcgi without modification, an error will be reported “fastcgi [pool www] cannot get gid for group ‘nobody’”

user = nobody

group = nobody

was modified to

user = www

group = www

Error 1: “fastcgi [pool www] cannot get gid for group ‘www’”

Solution: You need to create users and groups yourself

Sudo useradd www

Start fastcgi

/usr/local/php/sbin/php-fpm

Error 2: ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)

      ERROR: FPM initialization failed

Solution: netstat -lntup | grep 9000

Killall php-fpm

Error 3: 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

Execution: sudo dpkg -i --force-all getlibs-all.deb

T Sudo Apt-get update getlibs aapt

      2) Install 32-bit libraries

                  getlibs -p gnome-keyring:i386

3) Generate symbolic link

                  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; #External network access port number

               server_name  blue-desk.com.cn;

location / {

U root/usr/local/src/wwwroot;#The address of the application

                                                                                                                                                                                        off

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

location ~ .php$ {

                                                                                                                                                                                                                      since_ FastCGI_PASS 10.128.7.101:9000;#-connected port number connected to PHP-FPM, PHP-FPM configuration is at /usr/local/php/php-fpm.conf

fastcgi_index index.php;

                        fastcgi_param SCRIPT_FILENAME   /usr/local/src/wwwroot$fastcgi_script_name;     #/usr/local/src/wwwroot Application address

E include fastcgi_params;

}

}

3.2 Configure application

onethink application configuration

Database name: mysql

Username: root

Database password: 123456

The above introduces the deployment of PHP test environment on Ubuntu machine, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP's Current Status: A Look at Web Development Trends PHP's Current Status: A Look at Web Development Trends Apr 13, 2025 am 12:20 AM

PHP remains important in modern web development, especially in content management and e-commerce platforms. 1) PHP has a rich ecosystem and strong framework support, such as Laravel and Symfony. 2) Performance optimization can be achieved through OPcache and Nginx. 3) PHP8.0 introduces JIT compiler to improve performance. 4) Cloud-native applications are deployed through Docker and Kubernetes to improve flexibility and scalability.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

PHP: The Foundation of Many Websites PHP: The Foundation of Many Websites Apr 13, 2025 am 12:07 AM

The reasons why PHP is the preferred technology stack for many websites include its ease of use, strong community support, and widespread use. 1) Easy to learn and use, suitable for beginners. 2) Have a huge developer community and rich resources. 3) Widely used in WordPress, Drupal and other platforms. 4) Integrate tightly with web servers to simplify development deployment.

PHP vs. Other Languages: A Comparison PHP vs. Other Languages: A Comparison Apr 13, 2025 am 12:19 AM

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Python: Core Features and Functionality PHP vs. Python: Core Features and Functionality Apr 13, 2025 am 12:16 AM

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

See all articles