As mentioned above, it is still complicated to configure the Apache + PHP5 environment or Nginx + PHP5 environment in the production environment, that is, the familiar LAMP or NAMP architecture, even if you follow the detailed deployment documentation to install it, it is a long and troublesome process. However, it is simplified to use ports in FreeBSD, and I feel particularly comfortable with the development environment.
As mentioned above, it is still complicated to configure the Apache + PHP 5 environment or Nginx + PHP 5 environment in the production environment, that is, the familiar LAMP or NAMP architecture, even if you follow the detailed deployment documentation to install it, it is a long and troublesome process. However, it is simplified to use ports in FreeBSD, and I feel particularly comfortable with the development environment, we will record the deployment process in FreeBSD 8 as follows for your convenience.
1. install Apache2.2
Cd/usr/ports/www/apache22
Make install clean
◆ Remove IPV6
◆ Add MySQL
After the installation is complete, edit the/etc/rc. conf file and add the following content to/etc/rc. conf:
Apache22_enable = "YES"
Configure the Apache 2.2
After the installation is complete, back up the/usr/local/etc/apache22/httpd. conf file:
Cp/usr/local/etc/apache22/httpd. conf/usr/local/etc/apache22/httpd. conf. bak edit/usr/local/etc/apache22/httpd. conf file to make Apache22 Server support PHP:
Vim/usr/local/etc/apache22/httpd. conf 1. about 354 rows
Add the following content under AddType application/x-gzip. gz. tgz:
AddType application/x-httpd-php. php AddType application/x-httpd-php-source. phps 2. about 212 rows
Add index. php to the DirectoryIndex Main Directory index:
DirectoryIndex index. php index.html line 3. 152nd
DocumentRoot "/home/www" # save the web path and change it as needed
4. 178th rows
# Store the web path, which can be changed as needed
II. install PHP 5.2
Cd/usr/ports/lang/php52 make install clean select the following installation options:
◆ Remove IPV6
◆ Add CLI, CGI, APACHE, SUHOSION, FASTCGI, and PATHINFO
3. install the PHP 5.2-extensions extension
Cd/usr/ports/lang/php52-extensions
Make config
Make install
The installation and addition options of clean make config are as follows:
Add BZ2, CALENDAR, CTYPE, GD, GETTEXT, ICONV, MBSTRING, MCRYPT, MHASH, MYSQL, MYSQLI, OPENSSL, PCRE, POSIX, SESSION, SOCKETS, TOKENIZER, ZIP, ZLIB.
Under centos5.4 on my online server, it is very painful to manually compile the PHP 5 extension packages one by one with the source code; for Apache, for Nginx, for Nginx; in FreeBSD 8, everything is simple. this process is a bit long.
Copy/usr/local/etc/php. ini-dist to/usr/local/etc/php. ini:
Cp/usr/local/etc/php. ini-dist/usr/local/etc/php. ini
4. install ZendOptimizer
Cd/usr/ports/devel/ZendOptimizer
Make install clean
The installation instructions are as follows:
**************************************** ****************************************
You have installed the ZendOptimizer package.
Edit/usr/local/etc/php. ini and add:
[Zend]
Zend_optimizer.optimization_level = 15
Zend_extension_manager.optimizer = "/usr/local/lib/php/20060613/Optimizer"
Zend_extension_manager.optimizer_ts = "/usr/local/lib/php/20060613/Optimizer_TS"
Zend_extension = "/usr/local/lib/php/20060613/ZendExtensionManager. so"
Zend_extension_ts = "/usr/local/lib/php/20060613/ZendExtensionManager_TS.so"
**************************************** *****************************
Edit php. ini and copy the above [Zend] content to the end of the text:
Vim/usr/local/etc/php. ini
Restart your Web Server.
/Usr/local/etc/rc. d/apache22 restart
Test Apche Server's support for PHP and ZendOptimizer. create an index. php in/home/www and enter the following content:
Phpinfo ();
?>
I have installed this version 5.2.13, and the new PHP version is nearly updated to 5.3.3. However, ZendOptimizer of the old version does not support this version. Therefore, we will continue to use 5.2.13 based on the principle of stability;