PHP代码加密?

WBOY
Release: 2016-06-06 20:08:14
Original
1129 people have browsed it

想问下,各位做项目的时候,遇到老板让把代码加密的问题是如何解决的?

回复内容:

想问下,各位做项目的时候,遇到老板让把代码加密的问题是如何解决的?

试试这个,免费加密混淆:http://enphp.djunny.com/

PHP7中支持用opcache.file_cache导出脚本opcode实现源代码保护
在php.ini中配置:

<code>zend_extension=/png/php/7.0.0/lib/php/extensions/no-debug-non-zts-20151012/opcache.so 
opcache.memory_consumption=128 
opcache.interned_strings_buffer=8 
opcache.max_accelerated_files=4000 
;关闭PHP文件时间戳验证 
opcache.validate_timestamps=Off 
;每60秒验证php文件时间戳是否更新 
;opcache.revalidate_freq=60 
opcache.fast_shutdown=1 
;注意,PHP7下命令行执行的脚本也会被 opcache.file_cache 缓存. 
opcache.enable_cli=1 
;设置不缓存的黑名单 
;opcache.blacklist_filename=/png/php/opcache_blacklist 
opcache.file_cache=/png/php/opcache_file_cache 
opcache.enable=On </code>
Copy after login

opcache_compile_file.php 内容如下:

<code><?php function getfiles( $path , &$files = array() ) {
    if ( !is_dir( $path ) ) return null;
    $handle = opendir( $path );
    while ( false !== ( $file = readdir( $handle ) ) ) {
        if ( $file != '.' && $file != '..' ) {
            $path2 = $path . '/' . $file;
            if ( is_dir( $path2 ) ) {
                getfiles( $path2 , $files );
            } else {
                if ( preg_match( "/\.(php)$/i" , $file ) ) {
                    $files[] = $path2;
                }
            }
        }
    }
    return $files;
}
// 获取指定目录及其子目录下的所有PHP文件
$files = getfiles('/png/www/example.com/public_html/app/pma');
foreach($files as $file){
    opcache_compile_file($file); //编译PHP文件生成opcode
    file_put_contents($file, ''); //清空原来的PHP脚本
    echo $file."\n";
}
echo 'Total PHP Files: '.count($files)."\n";</code></code>
Copy after login

HipHop for PHP

我会和老板讲性能,讲开源,讲加班,讲加薪...
加密实在没用,万一线上出问题了,加密过的连调试都不行,不是麻烦死。

Zend有代码加密工具,买一套就行了。不但能加密还能设置加密后的代码能运行多长时间,比如你要给你家测试版,可以设置30天,到日子这代码就跑不了了。

模板与crud也加密?

为何要加密? 准备卖程序授权吗?

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!