PHP installation

xiaoxiao2021-03-06  106

1. gzip -d httpd-2_0_nn.tar.gz

2. TAR XVF httpd-2_0_nn.tar

3. Gunzip php-nn.tar.gz

4. Tar-xvf php-nn.tar

5. CD httpd-2_0_nn

6. ./configure --enable-so

7. make

8. make install

Now you have installed apache 2.0.nn in / usr / local / apache. This installation supports loading module

And standard MPM Prefork. After that, start the Apache server using the following command:

/ usr / local / apache2 / bin / apachectl start

If successful, you can stop the Apache server and continue to install PHP:

/ usr / local / apache2 / bin / apachectl stop.

9. cd ../php4-nn

10. Now we need to configure PHP. Here you can use a wide variety of parameters from defining phps, such as startup

Some extension function packages, etc. Use the ./configure --help command to list all currently available

number. In our example, we will give a configuration on Apache 2 supported by MySQL.

example. The path of your local APXS may be different, in fact, in your system, it may be named

APXS2.

./configure --prefix = / usr / local / php --with-apxs2 = / usr / local / apache2 / bin / apxs --with-mysql = / usr / local / mysql

11. make

12. make install

If you decide to change the configuration option after installation, you only need to repeat the last three steps, then you need to restart

Apache enables new modules to take effect. No need to recompile.

Note that unless prompted, the 'make install' command will install PEAR, various PHP tools

Such as PHPize, installing PHP CLI, and more.

13. Configure php.ini

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

You can edit the php.ini file to modify the PHP option. If you want to put this file in another location,

You need to add -with-config-file-path = / path options at step 10.

If you choose PHP.INI-Recommended, be sure to read the list of changes, they will affect

PHP execution.

14. Edit the httpd.conf file to call the PHP module. The path to the right side of the Loadmolude must point to you.

PHP in the system. The above Make Install commands may have already finished these, but must be checked.

For PHP 4:

LoadModule PHP4_Module Modules / Libphp4.so

For PHP 5:

LoadModule PHP5_MODULE MODULES / LIBPHP5.SO

15. Inform Apache to resolve specific extensions into PHP, for example, we let Apache will extends .php

Analysis into PHP. You can specify any extensions as PHP and simply add them, each with space separation.

For example, we have to add .phtml:

AddType Application / X-httpd-php .php .phtml

Typically, we also set the .phps extension to display the highlighted PHP source file, which can be done: addtype application / x-httpd-php-source .phps

16. Start your Apache server:

/ usr / local / apache2 / bin / apachectl start

转载请注明原文地址:https://www.9cbs.com/read-103990.html

New Post(0)