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 to install the php module in centos6

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

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!

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