很可能是因为你的扩展没有正确加载,如果是WINDOWS下的话,使用dl函数在PHP里进行加载:dl (PHP 4, PHP 5)dl — Loads a PHP extension at runtime说明 bool dl ( string $library ) Loads the PHP extension given by the parameter library. Use extension_loaded() to test whether a given extension is already available or not. This works on both built-in extensions and dynamically loaded ones (either through php.ini or dl()). Warning This function has been removed from some SAPI's in PHP 5.3. 参数library This parameter is only the filename of the extension to load which also depends on your platform. For example, the sockets extension (if compiled as a shared module, not the default!) would be called sockets.so on Unix platforms whereas it is called php_sockets.dll on the Windows platform. The directory where the extension is loaded from depends on your platform: Windows - If not explicitly set in the php.ini, the extension is loaded from C:\php4\extensions\ (PHP4) or C:\php5\ (PHP5) by default. Unix - If not explicitly set in the php.ini, the default extension directory depends on whether PHP has been built with --enable-debug or not whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change happened, e.g. 20010901) Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no-debug-zts-20010901. 返回值 成功时返回 TRUE, 或者在失败时返回 FALSE. If the functionality of loading modules is not available or has been disabled (either by setting enable_dl off or by enabling 安全模式 in php.ini) an E_ERROR is emitted and execution is stopped. If dl() fails because the specified library couldn't be loaded, in addition to FALSE an E_WARNING message is emitted. 范例Example #1 dl() examples<?php // Example loading an extension based on OS if (!extension_loaded('sqlite')) { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { dl('php_sqlite.dll'); } else { dl('sqlite.so'); } }// Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0 if (!extension_loaded('sqlite')) { $prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX); } ?> PS: 如果是linux的话,估计你的权限不够
别人echo(gzinflate(base64_decode($encode)));就可以解出来了,真不知道作用是什么。
我的想法是用mfc写个dll这个dll能够在zend模板解析模板文件之前对文件进行解密
建议找一些ZEND加密解密的方法
#include "php.h"
#include "php_ini.h"
#include "ext/standard/file.h"
#include "ext/standard/info.h"
)是不是要重新下一个啊?
另外其实我也想熟悉下写php的扩展
可是这个有加密的作用吗,别人只要echo不就出来了吗
我现在写了一个hello world的dll 扩展,但是在ini里设置载入,重启apache就出现内存空间不能read的错误。。救命啊~
如果要在虚拟空间上使用加密,用dll好像不行吧 ,因为一般没有权限。
这时候要用什么方法呢?另外p zend百度没有找到
扩展DLL的权限应该还是有的,关键是需要联系一下你的空间提供商
不知道是哪里错了,但是dll里面的自定义函数是可以调用得到的。
{
old_compile_file = zend_compile_file;
zend_compile_file = my_compile_file;
//php_printf("hello world--1");
return SUCCESS;
}
我在请求之前先保存原本的编译函数指针,然后用自己的my_compile_file赋值给zend_compile_file,但是貌似my_compile_file这个函数没有被执行到,因为我在里面php_printf()了但是页面没有显示出相应内容,也不太清楚扩展要怎么调试
很可能是因为你的扩展没有正确加载,如果是WINDOWS下的话,使用dl函数在PHP里进行加载:dl
(PHP 4, PHP 5)dl — Loads a PHP extension at runtime说明
bool dl ( string $library )
Loads the PHP extension given by the parameter library. Use extension_loaded() to test whether a given extension is already available or not. This works on both built-in extensions and dynamically loaded ones (either through php.ini or dl()). Warning
This function has been removed from some SAPI's in PHP 5.3. 参数library
This parameter is only the filename of the extension to load which also depends on your platform. For example, the sockets extension (if compiled as a shared module, not the default!) would be called sockets.so on Unix platforms whereas it is called php_sockets.dll on the Windows platform. The directory where the extension is loaded from depends on your platform: Windows - If not explicitly set in the php.ini, the extension is loaded from C:\php4\extensions\ (PHP4) or C:\php5\ (PHP5) by default. Unix - If not explicitly set in the php.ini, the default extension directory depends on whether PHP has been built with --enable-debug or not
whether PHP has been built with (experimental) ZTS (Zend Thread Safety) support or not
the current internal ZEND_MODULE_API_NO (Zend internal module API number, which is basically the date on which a major module API change happened, e.g. 20010901)
Taking into account the above, the directory then defaults to <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO, e.g. /usr/local/php/lib/php/extensions/debug-non-zts-20010901 or /usr/local/php/lib/php/extensions/no-debug-zts-20010901.
返回值
成功时返回 TRUE, 或者在失败时返回 FALSE. If the functionality of loading modules is not available or has been disabled (either by setting enable_dl off or by enabling 安全模式 in php.ini) an E_ERROR is emitted and execution is stopped. If dl() fails because the specified library couldn't be loaded, in addition to FALSE an E_WARNING message is emitted. 范例Example #1 dl() examples<?php
// Example loading an extension based on OS
if (!extension_loaded('sqlite')) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
dl('php_sqlite.dll');
} else {
dl('sqlite.so');
}
}// Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0
if (!extension_loaded('sqlite')) {
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
}
?> PS: 如果是linux的话,估计你的权限不够
PS,dl函数也是可以在LINUX下进行加载的,楼主先试试,看是否能正确加载,一般来说如果扩展路径正确、文件存在、PHP也正确加载了这个扩展的话,基本上就可以用了,再不行的话只能是权限的问题了