|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2014-11-24 07:35 UTC] czarek dot tomczak at gmail dot com
 Description:
------------
I am setting "blenc.key_file" in php.ini to a relative path:
    blenc.key_file="./__blenc_keys"
If I do so and run the encrypted script then it cannot find __blenc_keys file and an error occurs:
    Fatal error: blenc_compile: Validation of script 
    'C:\phpdesktop\phpdesktop-chrome\www\my_source_encoded.php' failed,
    cannot execute. in Unknown on line 0
It seems that when running encrypted script BLENC thinks that current directory is php/.
This behavior is inconsistent, because when running normal php script (not encrypted, resides in www/encrypt.php), then BLENC finds the blenc keys file just fine in www/ directory. But when you run encrypted "www/my_source_encoded.php" then it looks for blenc keys file in php/ directory.
I know that it's best to use an absolute path and it will work fine, but this is still a bug that can cause headache.
I can make it work with relative path using this trick:
    blenc.key_file="./../www/__blenc_keys"
This works for both cases whether BLENC thinks current directory is www/ or php/ (assuming that both these dirs have common upper directory eg. phpdesktop/www/ and phpdesktop/php/ in my case).
Tested with BLENC 1.1.4b.
Using Mongoose 3.9 webserver and PHP CGI.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Sun Oct 26 22:00:01 2025 UTC | 
UPDATE: I was wrong about BLENC searching for blenc keys file in php/ directory, when running encrypted script. It really looks for that file in application's executable directory. In my case I'm using PHP Desktop GUI framework to create a desktop application. The structure of files/dirs is following: phpdesktop/ phpdesktop/phpdesktop-chrome.exe phpdesktop/php/ phpdesktop/www/ When "blenc.key_file" is set to "./__blenc_keys" and running "phpdesktop/www/my_source_encoded.php" then BLENC expects the file to be in this path: phpdesktop/__blenc_keys