NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
PhpExpress API


Joined: 03 Feb 2008
Posts: 30
Reply with quote
I am trying to get the pelm_license_filename() and pe_handle_error($errcode, $errmessage, $licfilename) functions to work, but I keep getting error messages. Can someone please give me a specific example of each and what to do with it? My license file is named aw_lic.txt and my encoded .php file is moon.php. Thank you.

Here is what I have and what works:

Code:
<?php
phpexpress();

echo "<br><br>";

var_dump(phpexpress_hostid());

echo "<br><br>";

if (pelm_is_licensed == True)
{
  echo "moon.php is licensed";
}
else
{
  echo "moon.php is NOT licensed";
}

echo "<br><br>";

if (pelm_load_license("aw_lic.txt") == True)
{
  echo "The license file IS present";
}
else
{
  echo "The license file is NOT present";
}

?>
View user's profileFind all posts by a_edwallSend private message


Joined: 03 Feb 2008
Posts: 30
Reply with quote
When I set up a file called errhandler.php, whose contents are:

Code:
<?php
  pe_handle_error($errcode, $errmessage, "aw_lic.txt");

  echo $errcode . "<br><br>";

  echo $errmessage . "<br><br>";
?>


I get this error message when my date is expired:

Fatal error: Call to undefined function pe_handle_error() in c:\my documents\My Webs\localhost\nucoder\errhandler.php on line 2

I do not understand how this function works. Example, please? Thank you.
View user's profileFind all posts by a_edwallSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
Quote:
if (pelm_is_licensed == True)

didn't you mean if (pelm_is_licensed() == True) ?

Code:
if (pelm_load_license("aw_lic.txt") == True)

with this code you can load a license but you can not have current file to be executed if it is covered by this license.
To be executed, the opcodes should be unencrypted first but it can not be done without the license loaded.
So, you need to follow one of the ways briefly outlined below:
1) use --licfile aw_lic.txt nucoder commandline option and your scripts will try to load aw_lic.txt before they are executed
2) use phpexpress.add_license=aw_lic.txt setting in php.ini and license will be loaded when php starts up
3) if you want to load the license yourself in moon.php, you have to exclude moon.php from being covered by the license. To do this use --excludelic moon.php command line option.

Quote:
I am trying to get the pelm_license_filename() and pe_handle_error($errcode, $errmessage, $licfilename) functions to work

Similarly, you can't handle license errors in a file that is protected with license. Make sure that the file is excluded from the license coverage using --excludelic option and don't forget to specify errhandler.php in --eh option:
nu-coder --eh errhandler.php --excludelic errhandler.php ...

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
pe_handle_error() function?


Joined: 05 Aug 2009
Posts: 3
Reply with quote
Hi,
I've bought NU-CODER 2-3 days ago, and now i've a problem with pe_handle_error function.
I have created a license file named "xp.lic" and then encoded some PHP scripts with the command:
nu-coder -k try_me --licfile d:\web\xperiment\xp.lic --eh d:\web\xperiment\error_enc.php --excludelic d:\web\xperiment\error_enc.php d:\web\xperiment d:\web\codelock (document root for Apache server is d:\web)

the script error_enc.php contains follow lines:
<?php
pe_handle_error($errcode, $errmessage, "xp.lic") ;
?>
i'm getting a fatal error like this:

Fatal error: Call to undefined function pe_handle_error() in D:\web\Xperiment\error_enc.php on line 2

Yesterday I've posted the problem to support service but no answer yet Confused

Have you some suggestion? Is a bug?
View user's profileFind all posts by picmauroSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
pe_handle_error is a function that _you_ have to declare and this function will be called as soon as error related to loader functionality arose.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 05 Aug 2009
Posts: 3
Reply with quote
Thank You dmitri, but how could i intercept the error code, the message etc?
have you some example?

Thank you
View user's profileFind all posts by picmauroSend private message
Guru master

Joined: 05 Jul 2004
Posts: 660
Location: Belgium
Reply with quote
picmauro, as Dmitri says, it is a function that you declare, that means that if you create the function in your code you get the message and error code:
Code:
function pe_handle_error( $nErrorCode, $sErrorMessage, $sLicenseFile)
{
   echo "Error #$nErrorCode ($sErrorMessage) was raised while trying to load '$sLicenseFile'!";
}
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 05 Aug 2009
Posts: 3
Reply with quote
Thanks Blizz,
My problem was which method the variables was passed to function pe_handle_error and not how to declaire a function.
However there are different from "pe_handle_error($errcode, $errmessage, $licfilename)" and "pe_handle_error( $nErrorCode, $sErrorMessage, $sLicenseFile)"

Now does work
View user's profileFind all posts by picmauroSend private message
Guru master

Joined: 05 Jul 2004
Posts: 660
Location: Belgium
Reply with quote
The parameter names don't matter, as long as there are 3 (according to your example).
Glad it works now.
View user's profileFind all posts by BlizzSend private messageVisit poster's website
PHPExpress API - manage cache programmatically - possible?


Joined: 30 May 2006
Posts: 35
Reply with quote
Hi guys,

I must appreciate, that PHPExpress seems to be one of the best (meaning performance boost and stability) PHP opcode cache around.
So far I have tested it on IIS, apache+win, httpd+centos - no issues found.

Now I am wondering - would it be possible to publish somewhat more of basic API on it..?
Sometime, it would be very handy to control programmatically cached files - e.g.

- delete particular cached file
- add cached file (pre cache large scripts on startup)
- get array of cached files

APC has similar API.
Would you consider this please...?

Thank you.
Lubos
View user's profileFind all posts by lubosdzSend private message
PhpExpress API
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic