Solaris 10整合apache与php过程及出错处理
前几天,我在solaris 10上整合apache与php,其间遇到一些问题,很有代表性,在这里把相关的过程及处理措施记录下来,希望对大家有所帮助。
与solaris 9不同的是,solaris 10已经默认安装GNU开发工具(GCC,make等)。但默认的环境变量没有把相关的路径设置进去—看路径是否被设置进去,只要执行不带选项和参数的命令gcc就知道了—用find搜索文件make和gcc,然后把路径写进文件/etc/profile,我的系统的/etc/profile路径设置如下所示:
export PATH=$PATH:/usr/ccs/bin:/usr/sfw/bin Copy after login |
改完后执行source /etc/profile就可以了。鉴于solaris 10自带的tar不太方便,用GNU tar代替它,其过程如下:
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移动到一边, Copy after login 以便万一发生意外能够恢复回来//ln –s /usr/local/gnutar/bin/tar /usr/sbin/tar Copy after login |
接下来安装apache,其过程如下:
cd /roottar zxvf httpd-2.2.0.tar.gzcd httpd-2.2.0./configure –prefix=/usr/local/apache2 –enable-so makemake instal Copy after login |
察看是否生成目录/usr/local/apache2便知apache是否被正确安装。
安装php,其过程如下:
cd /roottar zxvf php-5.2.0.tar.gzcd php-5.2.0./configure -prefix=/usr/local/php -with-apxs2 Copy after login =/usr/local/apache2/bin/apxs ……… Copy after login |
这个过程不能正常运行下去,出现下面的报错信息:
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. Copy after login |
这表明系统自带的libxml2版本低,需要2.6.11以上的版本。有2种办法解决这个问题:升级libxml2和重新安装一个libxml2。在运行业务的solaris 环境,升级是一个十分冒险的办法,我们这里有很多程序员胡乱升级软件包把系统弄崩溃的先例,所以强烈建议象我一样保守,重新安装一个新的libxml2。只要我们在源码安装过程中指定了安装目录,安装了新的libxml2后不会对系统产生任何危害,当然占据那一点磁盘空间是微不足道的了。下面是安装一个新的 libxml的步骤:
cd /roottar zxvf libxml2-2.6.26.tar.gz./configure –prefix=/usr/local/libxmlmakemake install Copy after login |
这时我们再回来安装php
cd /root/php-5.2.0./configure -prefix=/usr/local/php5 -with-apxs2=/usr/local/apache2/bin/apxs Copy after login -with-libxml-dir=/usr/local/libxml //配置很顺利的完成了makemake install Copy after login |
最后一个步骤是配置和测试,实际上只需要修改apache的配置文件httpd.conf。由于在php的配置过程中使用了选项—with-apxs,因此会在htppd.conf文件中插入“LoadModule php5_module modules/libphp5.so”这一行,先检查一下看受否被自动写入;然后再手动插入行“AddType application/x-httpd-php .php .phtml”,注意:.php,.phtml前面各有一个空格,没有这个空格将不能正常解析php页面,这是一个很容易忽视的问题,请初学者留意。写一个最简单的测试文件index.php,包含“”,把它保存在apache根文档所在的目录(这里是/usr/local/apache/htdocs/index.php)。执行/usr/local/apache/bin/apachectl start启动apache守护进程,从浏览器输入

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
