Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install the php module in centos6

Shulou Source: shulou.com Published: 2022-06-03 19:38:10 11月12日 Update

This article mainly introduces "how to install php module centos6", in daily operation, I believe many people have doubts on how to install php module centos6, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, hope to answer "how to install php module centos6" doubts helpful! Next, please follow the small series to learn together!

This article operating environment: centos 6 system, php 5.6, thinkpad t480 computer.

Here are the steps to compile and install PHP 5.6 (apache module) for Centos 6.5:

I. Environmental preparation

1, Download php source package

# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz# tar -xf php-5.6.30.tar.gz -C /usr/local/src/

2. Create www users

# groupadd www# useradd -g www -s /sbin/nologin -M www

3. Install epel source

# yum install epel-release -y

4. Install dependency packages

# yum install gcc gcc-c++ make zlib zlib-devel libxml2 libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv libiconv-devel freetype-devel libpng-devel gd bison bison-devel readline-devel gd-devel libicu-devel libedit-devel libcurl-devel sqlite-devel jemalloc jemalloc-devel libxslt-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt pcre pcre-devel bzip2 bzip2-devel curl curl-devel openssl-devel openldap openldap-devel -y

II. Compilation and installation

./ configure --prefix=/usr/local/php \--with-config-file-path=/etc/php/ \--with-apxs2=/usr/local/httpd24/bin/apxs \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-gd \--with-iconv \--with-mcrypt \--with-mhash \--with-openssl \--with-curl \--with-zlib \--with-bz2 \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \--with-xsl \--with-pcre-dir \--with-readline \--with-gettext \--with-xmlrpc \--with-libxml-dir \--enable-shared \--enable-bcmath \--enable-soap \--enable-mbregex \--enable-pcntl \--enable-opcache \--enable-calendar \--enable-shmop \--enable-xml \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-sockets \--enable-ftp \--enable-zip \--enable-gd-jis-conv \--enable-exif \--enable-mbstring \--enable-inline-optimization \--disable-debug \--disable-rpath# make && make install

III. Configuration Services

# mkdir /etc/php# cp php.ini-development /etc/php/php.ini

Add environment variable PATH

# vim /etc/profilePATH=$PATH:/usr/local/php/bin export PATH # source /etc/profile

View php profile path

# /usr/local/php/bin/php --ini

View php compilation parameters

# /usr/local/php/bin/php-config

4. Configure Apache to support PHP

Modify Apache's configuration file httpd.conf

DirectoryIndex index.html index.php #Add index.php

Find:

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

add the following prior

AddType application/x-httpd-php-source .phps

AddType application/x-httpd-php .php

Check if LoadModule php5_module modules/libphp5.so has been added libphp5.so file exists

Write a test file index.php with the following contents and place it in Apache's default Web site directory DocumentRoot #default path/var/www/html

Start Apache service. If it fails to start, check the configuration file httpd.conf and find the error log error.log to correct the problem.

service httpd restart

Use your browser to visit http://IP/, you can view PHP configuration to indicate that you have succeeded

At this point, the study of "how to install php module in centos6" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Tags: Configuration modules files learning environment compilation content methods more paths problems help services utility success next parameters variables articles logs Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Tech Info macOS Shulou Technology MySQL