ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder

make_licence suddenly stopped working

Author Message
gnugent



Joined: 11 Nov 2008
Posts: 5

PostPosted: Fri May 28, 2010 7:20 pm    Post subject: make_licence suddenly stopped working Reply with quote

I use this code to call make_licence to automatically create licences for my software:

<?php
$strCommand = "path/make_license --passphrase 'abc' -o 'licence.txt' --allowed-server 'www.site.com'";
$aOutput = array();
exec($strCommand, $aOutput, $intRet);
echo $intRet;
?>

This has been working perfectly on Hostgator for 18 months. Now today, it's stopped working, the reason being that intRet is now returning 1 instead of 0.

Is a webserver configuration change likely to be the cause? If not, what does a result of intRet=1 actually mean?

Thanks,

Gary Nugent
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2801

PostPosted: Fri May 28, 2010 10:11 pm    Post subject: Reply with quote

This can happen if the license file cannot be created or if a server data file cannot be decoded. You're not using the latter so it's probably the former. Either way, there'll be something amiss with your server setup. You should use absolute paths instead of relative for everything, and check that your script has permission to read and write to the paths that you're using.
_________________
Community Admin
Back to top
View user's profile Send private message
gnugent



Joined: 11 Nov 2008
Posts: 5

PostPosted: Sat May 29, 2010 2:21 am    Post subject: Reply with quote

Hi Nick,

I've used the same code for generating licences for the last 18 months and I haven't changed anything. It just stopped working today. I suspect that a server configuration change at Hostgator is the cause of the problem - they've been changing their mod_security rules. Are you aware of anything (from other customers) related to that?

Thanks,

Gary
Back to top
View user's profile Send private message
gnugent



Joined: 11 Nov 2008
Posts: 5

PostPosted: Sat May 29, 2010 2:47 am    Post subject: Reply with quote

Just a thought: the make_licence file I'm using dates from early 2009. Do I need to update it to a newer version?
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2801

PostPosted: Sat May 29, 2010 4:23 am    Post subject: Reply with quote

No, and unlike the Encoder it doesn't require a license file, so will work indefinitely. If you check what output (i.e. error message) is being produced by the license generator that should lead you to a solution.
_________________
Community Admin
Back to top
View user's profile Send private message
gnugent



Joined: 11 Nov 2008
Posts: 5

PostPosted: Sat May 29, 2010 12:28 pm    Post subject: moonan went Reply with quote

The output is $intRet=1 and the $aOutput array is empty (using print_r($aOutput) to print out its contents. No error messages produced and there's nothing written out to the error_log file. I don't have anything else to go on.

Permissions for the folder containing the make_licence file are set to 755 and permissions on make_licence itself are also set to 755. What could be preventing the licence file from being created as you suggest?

Thanks,

Gary
Back to top
View user's profile Send private message
nimasdj



Joined: 09 Aug 2006
Posts: 117

PostPosted: Sat May 29, 2010 2:50 pm    Post subject: Reply with quote

Ask your hostmaster to run your script via shell. He should see the error message if running the script via shell.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2801

PostPosted: Sat May 29, 2010 7:11 pm    Post subject: Reply with quote

Incorrect ownership could be a problem - remember that the directory must be writable by the web server UID and not your own. Try using 777.

The error is probably not being seen as it went to stderr, while exec is only capturing stdout. Redirect stderr to stdout and then you should capture an error message, passthru() may also work, though off hand I'm not sure if that also only captures stdout. Check the PHP user guide to see.
_________________
Community Admin
Back to top
View user's profile Send private message
nimasdj



Joined: 09 Aug 2006
Posts: 117

PostPosted: Sun May 30, 2010 9:08 am    Post subject: Reply with quote

I have no problem to use make_license with exec() with chmod that file to 755 and the folder itself is 755 too. anyway, if he asks the hostmaster to run the script via shell, it should shows the error message. If his problem was permission he had to get error 126 but user is saying that he is getting error 1.

That user can discover the issue by changing his script to this:

script.php:

Code:
#!/usr/local/bin/php
<?php
$strCommand = "path/make_license --passphrase 'abc' -o 'licence.txt' --allowed-server 'www.site.com' 2>&1";
$aOutput = array();
$error = exec($strCommand, $aOutput, $intRet);
fwrite(STDERR,"Error: $error\n");
?>


then chmod this script to 755, then ask his hostmaster to run this script via shell using this command:
$ ./script.php

then the script tells the error message and he can discover why his make_license is not working.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2801

PostPosted: Mon May 31, 2010 2:11 am    Post subject: Reply with quote

Quote:
If his problem was permission he had to get error 126


An exit code of 126 is generated by PHP if a command fails to execute for some reason; error 1 is generated by make_license in some cases of permissions errors that it encounters.
_________________
Community Admin
Back to top
View user's profile Send private message
nimasdj



Joined: 09 Aug 2006
Posts: 117

PostPosted: Tue Jun 01, 2010 7:37 pm    Post subject: Reply with quote

So he will not get the error message with the code I gave above?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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