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 PHP as ApacheDSO

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

Share

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

This article introduces you how to install PHP as ApacheDSO, the content is very detailed, interested friends can refer to, hope to be helpful to you.

PHP is often used on the Linux/Unix platform in conjunction with the ApacheWeb server. When we install PHP in Apache, you have three installation modes to choose from: static module, dynamic module (DSO), and CGI. The following editor will explain how to install PHP as ApacheDSO?

How to install PHP as ApacheDSO

The maintenance and upgrade of this installation mode is quite simple. For example, suppose you only installed the database support features of PHP. But a few days later you decided to add encryption to PHP. Simply type the makeclean command, add new configuration options, and then execute the make and makeinstall commands. In this way, the new PHP module will be installed in the right place on the Apache, you just have to restart Apache and everything OK, of course, the whole process does not have to recompile Apache.

The simple steps to install the new version of Apache and install PHP as ApacheDSO are as follows:

1. Download the source code for the latest version of the Apache server software from the Apache Software Foundation site.

two。 Put the code files in the appropriate directory such as / usr/local/ or / opt/.

3. Use the Gunzip command to extract the code file, and then you can get the corresponding * .tar file.

4. Type the following unpacking command to place the above tar file in the directory called apache_ [version]:

Tar-xvfapache_ [version]. Tar

5. Go to the / usr/local/apache_ [version] directory (or the directory you specified in the above step).

6. Type the following configuration command, using the path you set (e.g. / usr/local/apache [version], etc., be careful not to follow the slash!) Replace the [path] parameter, and you also need to enable the mod_so parameter to allow Apache to use DSO.

. / configure--prefix= [path]-- enable-module=so

7. Go back to the command prompt and type the make command and wait for the command execution to finish and return to the command prompt again.

8. Type makeinstall.

At this point, the compiler can create the final directory and return to the system's command prompt.

How to install PHP as ApacheDSO

Next, install PHP:

1. Visit the download area of the PHP home page and select the link to the latest version of the source code.

two。 Put the downloaded files in the appropriate directory such as / usr/local/ or / opt/.

3. Use the Gunzip command to extract the code file, and then you can get the corresponding * .tar file.

4. Type the following unpacking command to place the above tar file in the directory called php- [version]:

Tar-xvfphp- [version]

5. Go to the / usr/local/php- [version] directory (or the directory you specified).

You can compile PHPDSO now, but you only need one necessary configuration option-- with-apxs (a file in the Apachebin directory)-- but to make the system configuration more comprehensive, we have also added support for MySQL databases here.

. / configure--with-mysql=/ [pathtomysql]-- with-apxs=/ [pathtoapxs]

6. Go back to the command prompt and type the make command and wait until the command is finished and return to the command prompt again.

7. Type the makeinstall command.

At this point, the compiler will create the final DSO, place it in the Apache module directory, modify the Apache httpd.conf configuration file for you, and then go back to the command prompt and wait for you to enter new instructions. Then, you can open Apache's httpd.conf configuration file to make some corrections:

1. Find the line with the word ServerAdmin and add your own email address, as follows:

ServerAdminyou@yourdomain.com

two。 Find the line that starts with ServerName, and change the following parameters to the actual values, such as:

ServerNamelocalhost

3. Find the following paragraph:

# AndforPHP4.x,use:

#

# AddTypeapplication/x-httpd-php.php

# AddTypeapplication/x-httpd-php-source.phps

Modify these configuration lines to remove some comments under PHP4.0 that precede AddType, and you should add some file extensions used for PHP, and the modified lines may look like this:

# AndforPHP4.x,use:

#

AddTypeapplication/x-httpd-php.php.phtml

AddTypeapplication/x-httpd-php-source.phps

Save the above configuration file, go back to the parent directory, and type the following command to start Apache:

. / bin/apachectlstart

If there are no problems during startup, you can test the installation of Apache and PHP by creating a file called phpinfo.php that contains the following lines of code:

Save the file and place it in Apache's document root directory (htdocs), then launch your Web browser, type http://localhost/phpinfo.php in the browser address bar, and the browser will display various variables and variable values of PHP and Apache systems at great length.

If you want to reset PHP, all you need to do is execute the makeclean command, then execute the. / configure command with the new configuration options, followed by make and makeinstall. In this way, a new module will appear in the Apache module directory. You just need to restart Apache to load the new module. Many of the previous headaches have now been easily solved.

On how to install PHP as ApacheDSO to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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