Difference between revisions of "LiteCommerce:Why...?"

From X-Cart 4 Classic
Jump to: navigation, search
Line 13: Line 13:
 
chmod -R 777 var.
 
chmod -R 777 var.
 
</pre>
 
</pre>
 +
 +
 +
===..I'm getting error that the license certificate is not valid and the Customer Area is closed?===
 +
 +
The license verification mechanism in LC works in the following way:
 +
 +
# The store address is obtained from the store config file etc/config.php.
 +
# An HTTP loopback request is made to this address.
 +
# A response received is checked in correspondence to the license certificate installed in the store (the LICENSE file).
 +
 +
So, the common issues which can cause the license verification mechanism to close the Customer Area are:
 +
 +
* The store address cannot be resolved to a correct IP address on the web server.
 +
* A loopback HTTP request cannot be made due to various reasons. For example, specific firewall rules on the webserver, specific datacenter infrastructure, etc.
 +
* The installed license certificate was issued for an address different from the one defined in the store config file.
 +
 +
The following PHP script emulates the loopback checking facilities used in LC. This script uses libCurl facilities.
 +
 +
<pre>
 +
<?php
 +
$options  = parse_ini_file("./etc/config.php", true);
 +
print "IP: " . gethostbyname($options["host_details"]["http_host"]) . "<br>";
 +
$url = "http://" . $options["host_details"]["http_host"] . $options["host_details"]["web_dir"];
 +
$last = strlen($url) - 1;
 +
$url .= ($url{$last} == "/") ? "" : "/";
 +
$url .= "cart.html";
 +
$ch = curl_init ($url);
 +
curl_setopt ($ch, CURLOPT_HEADER, 0);
 +
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
 +
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
 +
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
 +
curl_exec ($ch);
 +
print_r(curl_error($ch));
 +
curl_close ($ch);
 +
?>
 +
</pre>
 +
 +
This script uses "fopen()" PHP function:
 +
<pre>
 +
<?php
 +
$options  = parse_ini_file("./etc/config.php", true);
 +
print "IP: " . gethostbyname($options["host_details"]["http_host"]) . "<br>";
 +
$url = "http://" . $options["host_details"]["http_host"] . $options["host_details"]["web_dir"];
 +
$last = strlen($url) - 1;
 +
$url .= ($url{$last} == "/") ? "" : "/";
 +
 +
$begin = getmicrotime();
 +
$fd = fopen($url."cart.html", "r");
 +
if ($fd) {
 +
echo "fopen() succeeded<br>";
 +
fpassthru($fd);
 +
} else {
 +
echo "fopen() failed<br>";
 +
}
 +
$end = getmicrotime();
 +
echo "<br>Execution time: "; echo  $end - $begin;
 +
 +
function getmicrotime()
 +
{
 +
list($usec, $sec) = explode(" ",microtime());
 +
return ((float)$usec + (float)$sec);
 +
}
 +
 +
?>
 +
 +
</pre>
 +
 +
So, one of these scripts should be copied to a file, for example "test-loopback.php" and uploaded to the store directory. Then, it should be opened in a web browser. If everything is OK, the "cart.html" file content will be displayed.
  
 
[[Category:LiteCommerce FAQ]]
 
[[Category:LiteCommerce FAQ]]

Revision as of 22:57, 13 April 2010

..I'm getting "Cannot initialize module: the module license is invalid" error?

The error means that your license (recorded in LiteCommerce admin) does not contain data on the newly installed commercial module. When you purchase an add-on it is registered to your license and the certificate. You should update the license in the admin zone:

1. In "My licenses" section of your X-Cart Account, click on 'Certificate', copy the certificate text (remember to include all the digits), or 'Download certificate'.

2. Go to the store admin area, "Maintenance" menu -> "License" page. In section "Install / Update license", paste the certificate text (or upload the certificate file if you downloaded it from the helpdesk) and click 'Install/update license'.

..I'm getting error that the cart is not installed and I should run install.php?

Most likely the directory "var/" does not have writable permissions (777). Make sure this directory exists. If not, you can create it manually. Then set the 777 access permissions on it. Use "chmod" command to change permissions:

chmod -R 777 var.


..I'm getting error that the license certificate is not valid and the Customer Area is closed?

The license verification mechanism in LC works in the following way:

  1. The store address is obtained from the store config file etc/config.php.
  2. An HTTP loopback request is made to this address.
  3. A response received is checked in correspondence to the license certificate installed in the store (the LICENSE file).

So, the common issues which can cause the license verification mechanism to close the Customer Area are:

  • The store address cannot be resolved to a correct IP address on the web server.
  • A loopback HTTP request cannot be made due to various reasons. For example, specific firewall rules on the webserver, specific datacenter infrastructure, etc.
  • The installed license certificate was issued for an address different from the one defined in the store config file.

The following PHP script emulates the loopback checking facilities used in LC. This script uses libCurl facilities.

<?php
$options  = parse_ini_file("./etc/config.php", true);
print "IP: " . gethostbyname($options["host_details"]["http_host"]) . "<br>";
$url = "http://" . $options["host_details"]["http_host"] . $options["host_details"]["web_dir"];
$last = strlen($url) - 1;
$url .= ($url{$last} == "/") ? "" : "/";
$url .= "cart.html";
$ch = curl_init ($url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_exec ($ch);
print_r(curl_error($ch));
curl_close ($ch);
?>

This script uses "fopen()" PHP function:

<?php
$options  = parse_ini_file("./etc/config.php", true);
print "IP: " . gethostbyname($options["host_details"]["http_host"]) . "<br>";
$url = "http://" . $options["host_details"]["http_host"] . $options["host_details"]["web_dir"];
$last = strlen($url) - 1;
$url .= ($url{$last} == "/") ? "" : "/";
 
$begin = getmicrotime();
$fd = fopen($url."cart.html", "r");
if ($fd) {
echo "fopen() succeeded<br>";
fpassthru($fd);
} else {
echo "fopen() failed<br>";
}
$end = getmicrotime();
echo "<br>Execution time: "; echo  $end - $begin;
 
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
 
?>

So, one of these scripts should be copied to a file, for example "test-loopback.php" and uploaded to the store directory. Then, it should be opened in a web browser. If everything is OK, the "cart.html" file content will be displayed.