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

How centos6.8 deploys php

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces centos6.8 how to deploy php, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Centos6.8 deployment php methods: 1, install the dependency package; 2, download php;3, modify the php.ini configuration file; 4, configure environment variables; 5, configure apache;6, add extensions and test.

The operating environment of this paper: centos6.8 system, php7.0, Dell G3.

Centos6.8 source code installation php7.0

Install dependency packages

Yum-y install gd gd-devel zlib-devel libjpeg-devel libiconv-devel libxml2 libxml2-devel

Curl curl-devel mhash mcrypt libxslt-devel

Libmcrypt-devel libjpeg-devel libpng-devel

No package libmcrypt available encountered during installation

Solution: yum install epel-release / / expansion package update package

If the libiconv installation fails, you can download the source code and install it using the source code

Reference https://www.cnblogs.com/jkko123/p/6357670.html

Download php

Download address: http://cn2.php.net/distributions/php-7.0.1.tar.gz

Tar-zxvf php-7.0.1.tar.gz

Cd php-7.0.1

. / configure\

-- prefix=/usr/local/php7\

-- exec-prefix=/usr/local/php7\

-- bindir=/usr/local/php7/bin\

-- sbindir=/usr/local/php7/sbin\

-- includedir=/usr/local/php7/include\

-- libdir=/usr/local/php7/lib/php\

-- mandir=/usr/local/php7/php/man\

-- with-config-file-path=/usr/local/php7/etc\

-- with-mcrypt=/usr/include\

-- with-mhash\

-- with-openssl\

-- with-mysqli=shared,mysqlnd\

-- with-pdo-mysql=shared,mysqlnd\

-- with-gd\

-- with-iconv\

-- with-zlib\

-- enable-zip\

-- enable-inline-optimization\

-- disable-debug\

-- disable-rpath\

-- enable-shared\

-- enable-xml\

-- enable-bcmath\

-- enable-shmop\

-- enable-sysvsem\

-- enable-mbregex\

-- enable-mbstring\

-- enable-ftp\

-- enable-gd-native-ttf\

-- enable-pcntl\

-- enable-sockets\

-- with-xmlrpc\

-- enable-soap\

-- without-pear\

-- with-gettext\

-- enable-session\

-- with-curl\

-- with-jpeg-dir\

-- with-freetype-dir\

-- enable-opcache\

-- enable-fpm\

-- without-gdbm\

-- disable-fileinfo

-- with-apxs2= "/ usr/local/apache2/bin/apxs

Make

Make install

Configuration file

Cp / root/php-7.0.15/php.ini-development / usr/local/php7/lib/php.ini

Cp-R / root/php-7.0.15/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm

Cp / usr/local/php7/etc/php-fpm.conf.default / usr/local/php7/etc/php-fpm.conf

Cp / usr/local/php7/etc/php-fpm.d/www.conf.default / usr/local/php7/etc/php-fpm.d/www.conf

Mkdir / usr/local/php7/tmp

Chmod 766 / usr/local/php7/tmp

Modify php.ini configuration file

Extension_dir = "/ usr/local/php7/lib/php/extensions/no-debug-zts-20151012/"

Session.save_path = "/ usr/local/php7/tmp"

Configure environment variables

Echo 'export PATH=/usr/local/php7/bin:/usr/local/php7/sbin:$PATH' > > / etc/profile

Make effective source / etc/profile

Self-starting

Chkconfig-add php-fpm

Chkconfig php-fpm on

Start the service

Chmod 755 / etc/init.d/php-fpm

Service php-fpm start

Configure apache

After installing php, you need to configure apache to support php.

Add the following configuration to the configuration file of apache:

AddType application/x-httpd-php .php

This enables apache to call the php module to parse the php file

In

< IfModule dir_module>

DirectoryIndex index.html

< /IfModule>

Precede index.html with index.php in

test

Create a new index.php file under the htdocs of apache

< ?php phpinfo(); ? >

Test on the browser

Add extension

After the installation is complete, use phpinfo () to find an extension without pdo_mysql.

Download the compressed package of the pdo_mysql extension

Http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz

Tar-xzvf PDO_MYSQL-1.0.2.tgz

Cd / root/php-7.0.15/ext/pdo_mysql

/ usr/local/php7/bin/phpize

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

Make a soft link for the header file of mysql, because the installation directory is specified during mysql installation, no link is made, and the header file cannot be found

Ln-s / usr/local/mysql/include/ / usr/local/include/

Make

Make install

Modify php configuration file

Add to the configuration file:

Extension_dir = / usr/local/php7/lib/php/extensions/no-debug-zts-20151012/

Extension=pdo_mysql.so

Then restart php-fpm and apache

The test found that it was still invalid.

Discover through the phpinfo () function

Loaded Configuration File is none

Then cp / usr/local/php7/lib/php.ini / usr/local/php7/etc/

Retest successful

Thank you for reading this article carefully. I hope the article "how to deploy centos6.8 php" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report