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 apache and php under linux

2025-02-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "how to install apache and php under linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install apache and php under linux.

1.apache

Download the source package for apache's for Linux on the following page

Http://www.apache.org/dist/httpd/;

Save to the / home/xx directory, xx is a self-built folder, I built a wj folder.

List of commands:

Cd / home/wj

Tar-zxvf httpd-2.0.54.tar.gz

Mv httpd-2.0.54 apache

Cd apache

. / configure-prefix=/usr/local/apache2-enable-module=so

Make

Make install

Install apache to / usr/local/apache and configure apache to support dso mode

2.php

Download the source package for php's for Linux on the following page

Http://www.php.net/downloads.php

Save to / home/wj directory

List of commands:

Cd / home/wj

Tar-zxvf php-5.0.4.tar.gz

Mv php-5.0.4 php

Cd php

/ configure-- prefix=/usr/local/php5-- with-apxs2=/usr/local/apache2/bin/apxs-- with-config-file-path=/usr/local/lib-- enable-track-vars-- with-xml-- with-MySQL

Make

Make install

Where apache and mysql are changed according to the directory name of your installation, mine are = / usr/local/apache2/bin/apxs and MySQL

Cp php.ini-dist / usr/local/lib/php.ini

Install php to / usr/local/php in dso mode and set the configuration file directory to / usr/local/lib to enable mysql,xml support

3. Configuration

Vi / usr/local/apache/conf/httpd.conf

Configure apache as follows

# change the ServerAdmin mailto:linux@linuxidc.com line to your email address

# DocumentRoot "/ home/httpd/html/" here is the home directory of html files

# ditto

# Options FollowSymLinks MultiViews for security reasons, remove "Indexes"

#

# DirectoryIndex default.php default.phtml default.php3 default.html default.htm

#

# set the default file name order of apache

# AddType application/x-httpd-php .php .phtml .php3 .inc

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

# set php file suffix

Save and exit

Vi / usr/local/lib/php.ini

# register-golbals = On

Save and exit

4. Start the service

/ usr/local/apache/bin/apachectl start

5. test

Then write a php test page info.php: the content is as follows

Phpinfo ()

? >

Normally, you should be able to see the message of php. Congratulations on your successful Apche Mysql PHP installation.

6. Apache starts automatically--

Let's take self-starting apache as an example

Self-startup script:

/ usr/local/apache/bin/apachectl start

The file is located under / etc/rc.d/init.d and is called apached. Be careful to be executable.

# chmod x / etc/rc.d/init.d/apached / / sets the attribute of the file to executable

# ln-s / etc/rc.d/init.d/apached / etc/rc3.d/S90apache / / establish a soft connection, shortcut

# ln-s / etc/rc.d/init.d/apached / etc/rc0.d/K20apache

At this point, I believe you have a deeper understanding of "how to install apache and php under linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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

Servers

Wechat

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

12
Report