Operation steps of setting up php development environment under Linux environment

  • 2020-06-12 08:45:47
  • OfStack

This article mainly records the installation process of software/development environment through compilation, other installation methods are ignored!
Article Background:
Since php and Apache are installed in the compilation and installation mode, however, the compilation and installation mode requires c, c++ compilation environment.
Install ES9en-ES10en via apt
$ sudo apt-get install build-essential
Step 1 of the compilation and installation is generally divided into:
Compile the configuration
$./configure --XXX (parameter s)
Compile configuration issues:
You will not have a full understanding of the software before you install it
If you don't know everything and don't know how to install (with what parameters)
You can choose the easiest way to install first, and use multiple installations to solve this problem
The process is complex and requires very complex configuration of specific parameters, which can be viewed through configure --help
compile
$ make
The installation
$ sudo make install
* * * * * * * * * * * * * *
Apache installation
1. Download ES39en-2.2.11.tar. gz
2, decompression
tar zxvf httpd-2.2.11.tar.gz
In the path where the tar instruction is executed, an ES47en-2.2.11 directory is generated
3. View the compiled configuration information under 1
Switch to the httpd-2.2.11 directory after unzipping
./configure --help
This step gives you an idea of which modules can be installed and the installation configuration information that needs to be set
Step 1 check the manual for more information

4. Compile configuration
$./configure --prefix=/usr/local/apache2 \ Specified installation directory
-- enable-ES65en \ Allows external so modules
-- ES68en-ES69en =prefork url request jump policy
5. Compilation:
$ make
6. Installation :(sudo is used because the path to be installed /usr/local/apache2 is not a personal path)
$ sudo make install
Completion of Installation
7, test,
Modify httpd conf.
#ServerName ES89en.example.com :80 is modified to ServerName 127.0.0.1:80 (localhost:80)
Start sudo./ ES96en-ES97en start
Stop sudo./ ES101en-ES102en stop
Restart sudo./ ES106en-ES107en restart (this command is sometimes invalid and is replaced by stop+start)

* * * * * * * * * * * * * * *
PHP installation

1. Download ES117en-5.2.8. tar. gz
2, tar zxvf ES123en-5.2.8. tar.gz
3. View the compiled configuration information under 1
Switch to the httpd-2.2.11 directory after decompression
./configure --help
This step gives you an idea of which modules can be installed and the installation configuration information that needs to be set
Step 1 check the manual for more information
4. Compile the configuration
./configure --prefix=/home/guandl/webenv/php528 \
--enable-mbstring \
--with-apxs2=/usr/local/apache2/bin/apxs
5 to compile
make
6, installation,
sudo make install
Completion of Installation
7. Copy php.ini
Since there is no php configuration file under php/lib after general installation 1, you need to copy php.ini-ES157en from unzipped directory to lib
sudo cp php.ini-recommended /home/guandl/webenv/php528/lib/php.ini
8. Modify the httpd. conf profile
Add 1 more
LoadModule php5_module modules/ libphp5.ES173en php has been generated automatically when installing php
AddType application/x-httpd-php .php
9, test,
Prepare an php file, such as ES180en.php
< ?php
phpinfo();
? >
Put it in apache's htdocs directory
Restart apache
http://127.0.0.1/any.php


Related articles: