Home > Article > Backend Development > Solaris 10 integration apache and php process and error handling_PHP tutorial
A few days ago, I integrated apache and php on solaris 10. During the process, I encountered some problems, which are very representative. I will record the relevant processes and solutions here, hoping to be helpful to everyone.
Different from solaris 9, solaris 10 has GNU development tools (GCC, make, etc.) installed by default. But the default environment variable does not set the relevant path - see if the path is set, just execute the command gcc without options and parameters to know - use find to search for the files make and gcc, and then write the path into the file /etc /profile, the /etc/profile path setting of my system is as follows:
export PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin |
After changing it, just execute source /etc/profile. Since the tar that comes with solaris 10 is not convenient, use GNU tar to replace it. The process is as follows:
gunzip -d tar-1.16.tar.gztar xvf tar-1.16.tarcd tar-1.16./configure -prefix=/usr/local/gnutar //指定目录,否则可能报错makemake install //把包安装在目录/usr/local/gnutar了mv /usr/sbin/tar /usr/sbin/tar.orig //把系统自带的vi移动到一边, 以便万一发生意外能够恢复回来//ln –s /usr/local/gnutar/bin/tar /usr/sbin/tar |
Next, install apache. The process is as follows:
cd /roottar zxvf httpd-2.2.0.tar.gzcd httpd-2.2.0./configure –prefix=/usr/local/apache2 –enable-so makemake instal |
Check whether the directory /usr/local/apache2 is generated to know whether apache is installed correctly.
Installing php, the process is as follows:
cd /roottar zxvf php-5.2.0.tar.gzcd php-5.2.0./configure -prefix=/usr/local/php -with-apxs2 =/usr/local/apache2/bin/apxs ……… |
This process cannot run normally, and the following error message appears:
Configuring extensionschecking whether to enable LIBXML support... yeschecking libxml2 install dir... nochecking for xml2-config path... /usr/bin/xml2-configconfigure: error: libxml2 version 2.6.11 or greater required. |
This indicates that the libxml2 version that comes with the system is low and requires version 2.6.11 or above. There are 2 ways to solve this problem: upgrade libxml2 and reinstall libxml2. In the solaris environment where business is running, upgrading is a very risky approach. We have many precedents of programmers here randomly upgrading software packages and crashing the system. Therefore, it is strongly recommended to be conservative like me and reinstall a new libxml2. As long as we specify the installation directory during the source code installation process, installing the new libxml2 will not cause any harm to the system. Of course, the disk space occupied is insignificant. The following are the steps to install a new libxml:
cd /roottar zxvf libxml2-2.6.26.tar.gz./configure –prefix=/usr/local/libxmlmakemake install |
At this time we come back to install php
cd /root/php-5.2.0./configure -prefix=/usr/local/php5 -with-apxs2=/usr/local/apache2/bin/apxs -with-libxml-dir=/usr/local/libxml //配置很顺利的完成了makemake install |
The last step is configuration and testing. Actually You only need to modify the apache configuration file httpd.conf. Since the option -with-apxs is used in the php configuration process, the line "LoadModule php5_module modules/libphp5.so" will be inserted into the htppd.conf file. First check to see if it is automatically written; then manually Insert the line "AddType application/x-httpd-php .php .phtml". Note: There is a space in front of .php and .phtml. Without this space, the php page will not be parsed normally. This is a problem that is easily overlooked. Please Beginners take note. Write the simplest test file index.php, containing "", and save it in the directory where the apache root document is located (here is /usr/local/apache/htdocs/index.php) . Execute /usr/local/apache/bin/apachectl start to start the apache daemon, enter
from the browser