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

Centos 6.9 compile and install LAMP + xcache

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Centos 6.9 compile and install LAMP apache 2.4 + Mysql 5.7 + php5.6.34 + Fast-cgi + xcache

Experimental environment: VMware Workstation Pro 14 (trial version) system platform: CentOS release 6.9 (Final) kernel 2.6.32-696.el6.x86_64Apache/2.4.29 (Unix) PHP 5.6.34 (cli) xcache 3.2.01. Compile and install apache 2.4

Refer to Centos 6.9 apahce 2.4.29 for compilation and installation

two。 Binary installation Mysql 5.7

Refer to CentOS 6.9.Custom single instance binary method to install mysql5.7.21

3. Download the Stable version on the PHP official website

Http://php.net/downloads.php

# wget http://hk1.php.net/distributions/php-5.6.34.tar.bz24. To install dependent packages, individual packages require EPEL sources. You can configure the Yum source of Aliyun in advance. Note: the following dependent packages are only limited to the compilation parameters demonstrated below. # yum install bzip2-devel libxml2-devel libmcrypt-devel libmcrypt curl-devel gd-devel if you need to add modules dynamically later, you also need to install autoconf

Note: the above version of php-7.0 uses-- enable-mysqlnd-- withmysqli=mysqlnd. The original-- with-mysql is no longer supported.

5. Compilation and installation

Compilation parameters

For the api method of mysql, take a look at:

For versions above PHP5.3, in order to link to the MySQL database, you can specify mysqlnd so that you do not need to install MySQL or MySQL development packages on the machine first. Mysqlnd is available since php 5.3 and can be bound to it at compile time (without having to become dependent on specific MySQL client library bindings). Starting with PHP 5.4, for cases where with-mysql is not explicitly specified, the mysql local driver will be installed. You can refer to the following configuration: for example:-- with-mysql > equivalent to the parameter value of mysqlnd--with-mysqli > equivalent to the parameter value of mysqlnd--with-pdo-mysql > equivalent to the parameter value of mysqlnd because-- with-mysqli=/usr/local/mysql/bin/mysql_config is the explicitly specified representation.

# tar xvf php-5.6.34.tar.bz2# cd php-5.6.34./configure-- prefix=/usr/local/php-5.6.34\-- with-openssl\-- enable-mysqlnd\-- with-mysql=/usr/local/mysql\-- with-mysqli\-- with-pdo-mysql\-- enable-mbstring\-- with-freetype-dir\-- with-jpeg-dir\-with-png-dir\-- with-zlib\-- with- Libxml-dir=/usr\-- enable-xml\-- enable-sockets\-- enable-fpm\-- with-mcrypt\-- with-config-file-path=/etc\-- with-config-file-scan-dir=/etc/php.d\-- with-bz2\-- with-iconv\-- with-gd\-with-curl\-- disable-debug\-- enable-calendar

Compilation and installation

# Build complete appears in make-j 8. So, congratulations on compiling successfully # make install the following tips, on demand. Wrote PEAR system config file at: / usr/local/php-5.6.34/etc/pear.confYou may want to add: / usr/local/php-5.6.34/lib/php to your php.ini include_path/app/httpd/php-5.6.34/build/shtool install-c ext/phar/phar.phar / usr/local/php-5.6.34/binln-s-f phar.phar / usr/local/php-5.6.34/bin/pharInstalling PDO Headers: / usr/local/php-5.6.34/include/php/ext/pdo/

Create a soft link to facilitate version management

# cd / usr/local/#ln-s php-5.6.34/ php6. Copy the php configuration file and note that these files are in the source directory # cp php.ini-production / etc/php.ini# cp sapi/fpm/init.d.php-fpm / etc/rc.d/init.d/php-fpm# chmod + x / etc/rc.d/init.d/php-fpm to create a directory for other extension configurations # mkdir / etc/php.d7. Modify the php-fpm startup script # vim / etc/rc.d/init.d/php-fpm > this step does not have to modify, but here is to later switch between different versions to facilitate prefix=/usr/local/php > change this line to the specified compilation path 8. Generate the php-fpm configuration file # sed-ri.bak s#php-5.6.34#php#g / usr/local/php/etc/php-fpm.conf.default# mv / usr/local/php/etc/php-fpm.conf.default / usr/local/php/etc/php-fpm.conf# mv / usr/local/php/etc/php-fpm.d/www.conf.default / usr/local/php/etc/php-fpm.d/www.conf > without 9. Add php-fpm to start the service # chkconfig-- add php-fpm# chkconfig php-fpm on10. Configure httpd to support php# vim / etc/httpd2.4/httpd.conf to ensure that the following 2 uncomment LoadModule proxy_module modules/mod_proxy.soLoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so# if you are using a virtual host form Add the following four lines to the host tag AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phpsProxyRequests OffProxyPassMatch ^ / (.*\ .php) $fcgi://127.0.0.1:9000/app/www/virtualhost/$1 where / app/www/virtualhost refers to the site file directory example: DocumentRoot "/ app/www/virtualhost" ServerName www.hunk.tech AddType application/x-httpd-php .php AddType application/ X-httpd-php-source .phps ProxyRequests Off ProxyPassMatch ^ / (. *\ .php) $fcgi://127.0.0.1:9000/app/www/virtualhost/$1 DirectoryIndex index.php index.html AllowOverride None Options None Require all granted # service httpd restart# service php-fpm start10. Test php#ss-nltfcgi is listening on port State Recv-Q Send-Q Local Address:Port LISTEN 0128 127.0.0.1 State Recv-Q Send-Q Local Address:Port LISTEN 9000 to edit a php test file # vim / app/www/virtualhost/index.php

11. Connection database test

Create an account in mysql for connection

There is no password field in the mysql > create user test@'192.168.5.102' identified by 'password';mysql5.7 database. The password field has been changed to authentication_string and the password policy is controlled by the password policy. The following is to modify the default password policy, 0=LOW, at least 8 characters mysql > set global validate_password_policy=0.

The test code is as follows:

# vim / app/www/virtualhost/check.php# curl www.hunk.tech/check.php connection succeeded

The following code determines whether the mysql and mysqli extensions are installed

twelve。 Test the performance before accelerator is enabled # ab-c 1000-n 5000 192.168.5.102/check.phpServer Software: Apache/2.4.29Server Hostname: 192.168.5.102Server Port: 80Document Path: / check.phpDocument Length: 12 bytesConcurrency Level: 1000Time taken for tests: 6.751 secondsComplete requests: 5000Failed requests: 0Write errors: 0Total transferred: 915000 bytesHTML transferred: 60000 bytesRequests per second: 740.59 [# / sec] (mean) Time per request: 1350.282 [ms] (mean) Time per request: 1.350 [ms] (mean Across all concurrent requests) Transfer rate: 132.35 [Kbytes/sec] receivedConnection Times (ms) min mean [+ /-sd] median maxConnect: 0 210 625.4 1 3019Processing: 1 436 954.0 190 6676Waiting: 1 435 954.0 954.0 6675Total: 63 645 1295.6 194 6734Percentage of the requests served within a certain time (ms) 50% 194 66 215 75% 335 80% 405 90% 1341 95% 3439 98% 6299 99% 6697 6734 (longest request) 13. Compile and install xcache go to the official website to download the source package

Http://xcache.lighttpd.net

Http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz

Install the dependency package required by phpize # yum install M4 autoconf extract xcache-3.2.0.tar.bz2#tar xvf xcache-3.2.0.tar.gz to generate xcanche compilation file # cd xcache-3.2.0#/usr/local/php/bin/phpize > Note This points to the php directory Configuring for:PHP Api Version: 20131106Zend Module Api No: 20131226Zend Extension Api No: 220131226 compilation installation xcache#. / configure-- enable-xcache-- with-php-config=/usr/local/php/bin/php-config attention -- sysconfdir points to the directory where Php stores the configuration files # make & & make installInstalling shared extensions: / usr/local/php-5.6.34/lib/php/extensions/no-debug-non-zts-20131226/ copies the xcache configuration file # cp xcache.ini / etc/php.d/ restart the php service and verify # service php-fpm restart# / usr/local/php/bin/php-m | grep-i xcacheXCacheXCache Cacher

You can also see through phpinfo

14. Test the performance after enabling the accelerator # vim / etc/php.d/xcache.inixcache.optimizer = Onxcache.size = 1024M#ab-c 1000-n 5000 192.168.5.102/check.phpServer Software: Apache/2.4.29Server Hostname: 192.168.5.102Server Port: 80Document Path: / check.phpDocument Length: 12 bytesConcurrency Level: 1000Time taken for tests: 6.541 secondsComplete requests: 5000Failed requests: 0Write errors: 0Total transferred: 915000 bytesHTML transferred: 60000 bytesRequests per second: 764.46 [# / sec] (mean) Time per request: 1308.116 [ms] (mean) Time per request: 1.308 [ms] (mean Across all concurrent requests) Transfer rate: 136.62 [Kbytes/sec] receivedConnection Times (ms) min mean [+ /-sd] median maxConnect: 0 277 612.3 2 3017Processing: 1 425 835.1 4186Waiting: 1 424 835.1 155 4185Total: 61 702 1187.2 167 5262Percentage of the requests served within a certain time (ms) 50 167 66 235 75% 436 80% 1021 90% 2137 95% 3817 98% 5138 99% 5197 100% 5262 (longest request)

The seemingly simple test did not find any advantages.

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

Database

Wechat

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

12
Report