【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

2年前 (2022) 程序员胖胖胖虎阿
157 0 0

1,下载apache2.2 和 php5.3.2

 

2,安装apache。我装的是httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi,装的时候记得更改apache安装目录【这对后续更改apache配置文件的效率会更高】 以及端口。 默认的端口是80 。 如果装了iis,记得更改其他的端口。

 

3, 安装php5.3.2。我装的是php-5.3.2-Win32-VC6-x86.zip这个文件。解压到一个方便的目录下。我解压到了D:\php文件夹下。

 

4, 将“php.ini-developer”更名为“php.ini”。

 

5,修改php.ini:

1),extension_dir路径改为:D:\php\ext

【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

2),查找oracle 的extension,将前面的分号去掉:

【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

 

6, 配置apache支持php。找到apache安装目录,conf文件夹下的httpd.conf文件,打开:

1)设置起始页:

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

 

2)配置php:在#LoadModule vhost_alias_module modules/mod_vhost_alias.so后,添加:

# For PHP 5 do something like this:
LoadModule php5_module "D:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .htm .html    
# configure the path to php.ini
PHPIniDir “D:/php/”

【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

 

3)修改根目录(类似iis的站点根目录):

DocumentRoot 修改为:DocumentRoot "D:/htdocs"

【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

Directory修改为:

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

 

4)保存httpd.conf文件

 

7,在D:\htdocs 新建一个index.html,内容如下:

<html>
<body>
 
<?php
 
if ($c=OCILogon("nhi", "nhi", "hisdb"))   //如果连接成功
    {
        echo "Successfully connected to Oracle.\n";
        
        $query = 'select name,open_mode from v$database';  //查询显示
        $stid = oci_parse($c, $query);
        $r = oci_execute($stid);
        
        
        // Fetch the results in an associative array 
        print '&lt;table border="1">';
        while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) {
           print '<tr>';
           foreach ($row as $item) {
              print '<td>'.($item?htmlentities($item):' ').'</td>';
           }
           print '</tr>';
        }
        print '</table>';
   
        ocilogoff($c);                               //关闭连接
    } 
else                                                //否则显示错误       
    { 
        $err = OCIError();
        echo "Oracle Connect Error " .$err[text];
    }
 
phpinfo();                                         //显示php信息
 
?>
 
</body>
</html>

8,打开http://localhost ,查看:

【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置

版权声明:程序员胖胖胖虎阿 发表于 2022年9月14日 下午5:16。
转载请注明:【Vegas原创】Apache2.2 + PHP5.3.2 + Oracle 10g配置 | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...