php中使用com组件出现"拒绝访问"的处理
代码如下,
// 建立一个指向新COM组件的索引
$word = new COM("word.application") or die("Can't start Word!");
// 显示目前正在使用的Word的版本号
echo "Loading Word, v. {$word->Version}
";
exit;
?>
有时候你会得到一个错误,
PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed
to create COM object `word.application': 拒绝访问. '
解决方法:
点击开始菜单,运行dcomcnfg
双击“组件服务”,双击“计算机”,双击“我的电脑”,选择“DCOM设置”
在右边找到需要的COM组件,此例中为“Microsoft Word 文档”
右击,打开“属性”菜单,选择“安全”标签
将“启动和激活权限”设置成“自定义”,然后点击编辑
点击“添加”>>“高级”>>“立即查找”,找到“internet 来宾用户”(默认为IUSER_电脑名),点击“确定”
将“internet 来宾用户”的权限设置为本地启动允许,本地激活允许
确定,完成
再次运行上述程序,显示结果为
"Loading Word, v. 11.0"
本文地址
DONE.Good Luck.^^
补充:
php.ini中设置
com.allow_dcom = true
参考资料:
http://bugs.php.net/bug.php?id=32133
http://figured-it-out.com/figured-out.php?sid=24
相关文档:
用Ajax实现Tab效果的
先创建
ajax.php,在其中输入如下代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sample 2_1</title>
<me ......
每次我们访问 PHP 脚本的时候,都是当所有的PHP脚本执行完成后,我们才得到返回结果。如果我们需要一个脚本持续的运行,那么我们就要通过 PHP 长连接的方式,来达到运行目的。
每个 PHP 脚本都限制了执行时间,所以我们需要通过 set_time_limit 来设置一个脚本的执行时间为无限长;然后使用 flush() 和 ob_flush() ......
<?php
define('SMARTY_TMP_DIR','C:/php5/Smarty-2.6.13/');
define('SMARTY_DIR','C:/php5/Smarty-2.6.13/libs/'); //SMARTY_DIR ->smarty keyword,must be defined as libs dectory
require_once(SMARTY_DIR.'Smarty.class.php');
//建立一个smarty对象
$smarty = new Smarty;
$smarty->template_dir = ......
PHP创建文件(夹)以及目录操作
一、目录操作
首先是从目录读取的函数,opendir(),readdir(),closedir(),使用的时候是先打开文件句柄,而后迭代列出:
<?php
$base_dir="filelist/";
$fso=opendir($base_dir);
echo $base_dir."<hr/>";
whil ......
configure: error: Unable to find libgd.(a|so)
如果使用的是ubuntu或debian就很简单了,直接sudo apt-get install apache2
libapache2-mod-php5 php5 php5-gd 就基本上搞定,但是用源代码安装还是很麻烦~
wget http://www.boutell.com/gd/http/gd-2.0.11.tar.gz
tar zxvf gd-2.0.11.tar.gz
cd gd-2.0.11
sudo . ......