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 configure centos and install apache+php

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This issue of the content of the editor will bring you about how to configure centos apache+php installation, the article is rich in content and professional analysis and description for you, after reading this article, I hope you can get something.

The centos configuration apache+php file is a common system file, so I studied the centos configuration installation of apache+php, and here I publish my personal understanding of the centos configuration installation.

Centos configuration apache+php

First of all

Download software

Apache download address http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz

Php download address: http://cn.php.net/distributions/php-5.2.6.tar.gz

Mysql download address: http://mysql.ntu.edu.tw/Downloads/MySQL-5.0/mysql-5.0.51a-linux-i686-glibc23.tar.gz

First

[root@localhost] # wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz

00, 47, 14, 30, http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz.

Resolving apache.mirror.phpchina.com... 221.194.139.225

Connecting to apache.mirror.phpchina.com | 221.194.139.225 |: 80. Connected.

HTTP request sent, awaiting response... 200 OK

Length: 6396996 (6.1m) [application/x-gzip]

Saving to: `httpd-2.2.9.tar.gz.1'

0% [] 36300 41.3K/s

[root@localhost] tar zxvf httpd-2.2.9.tar.gz

Decompress below

Httpd-2.2.9/srclib/apr-util/test/abts_tests.h

Httpd-2.2.9/srclib/apr-util/test/data/

Httpd-2.2.9/srclib/apr-util/test/dbd.c

Httpd-2.2.9/srclib/apr-util/test/Makefile.in

Httpd-2.2.9/srclib/apr-util/test/Makefile.win

Httpd-2.2.9/srclib/apr-util/test/nw_misc.c

Httpd-2.2.9/srclib/apr-util/test/nwgnuaputest

The word N is omitted here.

Then enter

Compile apache under [root@localhost ~] cd httpd-2.2.9

[root@localhost httpd-2.2.9]. / configure-- prefix=/usr/local/apache-- enable-track-vars-- enable-cgi-- with-config-file-path=/usr/local/apache/conf

It will take some time to compile the centos configuration below.

Here is a brief description of what it means to compile the centos configuration

Prefix=//usr/local/mysql/apache specifies that apahce is installed in the / / usr/local/mysql/apache directory

Enable-cgi supports CGI

With-config-file-path=//usr/local/mysql/apache/conf specifies that the configuration file for apache is placed in / / usr/local/mysql/apache/conf; for example, the httpd.confcentos configuration file is in this directory

Enable-track-vars enables tracking functions such as get/post of cookie.

It's almost compiled. Will prompt apache to install successfully

[root@localhost] make;make install / / then enter the command to compile it is as simple as make;make install!

Then enter to start the apache service.

[root@localhost] server httpd restart

Apache installed successfully here

Delete the default page

Rm-f / usr/local/apache/conf.d/welcome.conf can see the lovely 403 error!

Centos configuration installation php

[root@localhost ~] # tar zxvf php-5.2.6.tar.gz / / extract the php file

[root@localhost ~] # cd php-5.2.6 / / enter the php installation directory

[root@localhost php-5.2.6] #] #. / configure-- prefix=//usr/local/mysql/php-- with-mysql=//usr/local/mysql/mysql-- with-apxs2=//usr/local/mysql/apache/bin/apxs-- enable-track-vars-- enable-force-cgi-redirect-- with-config-file-path=//usr/local/mysql/php/etc / / compile php

Install: [root@localhost php-5.2.6] # make

[root@localhost php-5.2.6] # make install

Copy php.ini-dist to php.ini and store it in the / usr/local/php directory!

[root@localhost php-5.2.6] # cp php.ini-dist / usr/local/php/php.ini

Edit the / usr/local/php/php.ini file and find the following line

; default_charset = "iso-8859-1"

Add a line below this line

Default_charset = "gb2312

/ / the following combination of apache+php

Find the line # AddType application/x-tar .tgz and add a line below. Don't add a # in front of it.

AddType application/x-httpd-php .php

Find the following line and add index.php after it, which means that the default page of the site can also be index.php.

DirectoryIndex index.html index.html.var index.php

Let's go to the next page where we test php.

Edit vi / usr/www/html/test.php write

Echo > > / usr/www/html/test.php is fine. Php+apache is successfully installed here.

The above is the editor for you to share how to configure centos apache+php installation, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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

Servers

Wechat

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

12
Report