Diagnosing and Resolving Script Errors

General Recommendations

To optimize server and database performance, it’s important to consider several key factors that can impact query processing speed and overall site efficiency. Here are some steps you can take:

1. Increase Server Capacity:

  • Upgrade RAM: Increasing the server’s RAM can help process data faster.

  • Add More CPU Cores: Additional CPU cores can speed up computations and database operations.

2. Check Server Settings:

  • Eliminate Unnecessary Tasks: Ensure there are no redundant tasks or processes running on the server that could slow it down.

  • Optimize Configuration: Review server and database settings to ensure they are optimized for efficient operation.

3. Monitor Performance:

  • Use Monitoring Tools: Utilize specialized tools to monitor system performance, identify bottlenecks, and detect issues.

4. Experiment with Configuration:

  • Test Resource Adjustments: Experiment with increasing resources (e.g., memory, CPU cores) and evaluate their impact on performance.

5. Backup Data:

  • Create Regular Backups: Regularly backing up data ensures information security and protects against data loss.

Implementing these steps can help optimize server and database performance, improve system efficiency, and reduce query processing times. If needed, consult experienced system administrators for more precise configuration.


Common Issues and Solutions

Below are some potential errors that may occur when working with scripts, along with methods to resolve them.


Infinite Redirect/Error in Redirect

If you encounter an infinite redirect loop, adjust the server control panel settings (e.g., ISP Manager or similar). Enable the option "Redirect HTTP requests to HTTPS" (example for ISP Manager).

Example Image

Slow or Failed Request Creation

If requests take too long to create or fail altogether:

  1. Disable the SMTP server in the "Messages -> Email Templates" section if you are using outgoing mail. Then, check the request creation speed.

  2. If the request creation speed improves, switch to one of the recommended SMTP servers.

Example Image

Currency Selection Table Freezes

To resolve freezing issues when selecting currencies:

  1. Go to the Cloudflare dashboard.

  2. Under "Caching" -> "Configuration," set the caching option to "No query string."

Example Image

Malformed Exported XML File

If the exported XML file fails validation, it’s often due to empty lines at the beginning of one or more script files.

  1. Locate the root folder of your site (e.g., var/www/www-root/data/www/domain_name) and navigate to it:

    cd var/www/www-root/data/www/domain_name
  2. Use the following command to find files with empty first lines:

    find . -name "*.php" -type f -exec sh -c 'if [ "$(head -n 1 "$1" | tr -d "\n")" = "" ]; then echo "$1: empty first line"; fi' _ {} \;
  3. Open the identified files and remove the empty lines.

Additionally, ensure the first line of the XML file includes encoding and version information (prolog). If missing, re-upload the script files to update them.

Example Image

Unstable HTTPS Site Performance

  1. Verify the domain is correctly specified as https://your_domain in the "Settings" -> "General" section of the admin panel.

  2. Check the database (xxxx_options table) to ensure the domain is also listed as https://your_domain.

  3. If using Cloudflare, set the encryption type to Flexible under "SSL/TLS" -> "Overview."

  4. If using a self-signed certificate, select "Full (Encrypts end-to-end, using a self-signed certificate on the server)."

  5. Disable the permanent redirect to HTTPS in the site settings within ISP Manager.

Example Image

Theme Activation Error

If activating a theme results in an error like Unclosed '{' on line ...:

  1. Enable the short_open_tag option in the PHP configuration file (php.ini).

  2. Access ISP Manager as root, navigate to PHP settings, or manually edit the php.ini file.

  3. Search for short and enable the displayed option.

Example Image

Site Inaccessible on Certain Devices/Providers

If the site doesn’t load on some devices or networks:

  1. Disable proxying in the Cloudflare dashboard:

    • Go to "DNS" -> "Records."

    • Edit the A-record and disable proxying in the "Proxy status" column.

  2. Note: Disabling proxying exposes your server’s real IP address and removes DDoS protection. Only disable proxying as a last resort.

Example Image

Site Inaccessible in Russia (Disabling ECH)

Roskomnadzor has started blocking Cloudflare due to its use of encrypted SNI headers (Server Name Indication). This technology prevents identifying the site being accessed via HTTPS, leading to blocks.

To disable Encrypted Client Hello (ECH) for your domain on Cloudflare:

  1. Check if ECH is enabled:

    • Replace example.com with your domain in the following link:

      https://dns.google.com/query?name=example.com&type=HTTPS
    • If the response includes the parameter ech=, ECH is enabled.

  2. Follow Cloudflare’s instructions to disable ECH.

Note: Disabling ECH does not guarantee site accessibility but often resolves the issue.

Example Image

For Free Cloudflare Plans

If you are on a free Cloudflare plan, additional steps may be required to resolve the issue.

Here’s the translation of the provided text into natural, fluent English:


Disabling ECH on the Free Plan is only available via the service API.

You will need the following:

  • Email — the email address associated with your Cloudflare account.

  • Global API Key — a key used to authenticate your API requests.

  • Zone ID — the unique identifier for your zone (domain) in Cloudflare.

Step 1: Global API Key

Go to the Cloudflare dashboard via the following link and copy your Global API Key: https://dash.cloudflare.com/profile/api-tokens

Step 2: Zone ID

Navigate to the management page for your domain in Cloudflare and scroll down. Locate the Zone ID field and copy it.


Disabling ECH via curl (Option 1):

Now that you have your Global API Key and Zone ID, you can disable ECH using curl.

Install curl

Curl is a tool for sending HTTP requests, which you’ll need to interact with the Cloudflare API.

  1. On Windows:

    • Download and install curl from the official website.

    • For CMD:

      1. Press Win + R.

      2. Type cmd and press Enter.

      3. Check the version by running the following command:

        curl --version
    • For PowerShell:

      1. Press Win + R.

      2. Type cmd and press Enter.

      3. Check the version by running the following command:

        curl.exe --version
  2. On Linux/MacOS:

    • Curl is usually pre-installed. Verify by running:

      curl --version

Now that you have your Zone ID and API Key, execute the following command:

  • Replace {ZONE_ID} with your Zone ID from the Cloudflare dashboard.

  • Replace {ACCOUNT_EMAIL} with your Cloudflare account email.

  • Replace {GLOBAL_API_KEY} with your Global API Key.

For Windows CMD:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/settings/ech" ^
     -H "X-Auth-Email: {ACCOUNT_EMAIL}" ^
     -H "X-Auth-Key: {GLOBAL_API_KEY}" ^
     -H "Content-Type: application/json" ^
     --data "{\"id\":\"ech\",\"value\":\"off\"}"

For Windows PowerShell:

curl -Method PATCH "https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/settings/ech" `
    -Headers @{
        "X-Auth-Email" = "{ACCOUNT_EMAIL}";
        "X-Auth-Key" = "{GLOBAL_API_KEY}";
        "Content-Type" = "application/json"
    } `
    -Body '{"id":"ech","value":"off"}'

For Linux:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/{ZONE_ID}/settings/ech" \
     -H "X-Auth-Email: {ACCOUNT_EMAIL}" \
     -H "X-Auth-Key: {GLOBAL_API_KEY}" \
     -H "Content-Type: application/json" \
     --data '{"id":"ech","value":"off"}'

If the request is successful, Cloudflare will return a response confirming that ECH has been disabled:

{"result":{"id":"ech","value":"off","modified_on":null,"editable":true},"success":true,"errors":[],"messages":[]}

Disabling ECH via Postman (Option 2):

You can also perform this action using Postman. Postman is a tool for testing APIs that allows you to send requests to a server, receive responses, and analyze them. It supports HTTPS and enables you to create requests with headers, parameters, and body content.

To disable ECH in Postman, create a new request and select the PATCH method. Replace zone_id in the URL with your Zone ID:

https://api.cloudflare.com/client/v4/zones/zone_id/settings/ech

In the Headers tab, add the following keys:

  • X-Auth-Email — your Cloudflare account email.

  • X-Auth-Key — your Global API Key.

  • Content-Type — set the value to application/json.

In the Body tab, select raw and enter the following JSON:

{"id": "ech", "value": "off"}

Then click the Send button.


If You Have a Paid Cloudflare Plan:

  1. Log in to your Cloudflare account.

  2. Select your site.

  3. Go to the SSL/TLS section.

  4. Open the Edge Certificates tab.

  5. Locate the Encrypted Client Hello (ECH) option.

  6. Simply toggle it to the Off position.


Image Captcha Not Displaying on Website Pages

Set write permissions (e.g., 777) for the folder /wp-content/pn_uploads/captcha/ or /wp-content/uploads/captcha/.

If you’re unsure how to do this, contact your hosting provider’s support team for assistance.


The rest of the document contains troubleshooting steps for various issues, such as missing images, email delivery problems, QR code generation, and more. Let me know if you’d like me to translate those sections as well!

Here’s the translated text in natural English:


Error: "No columns in the database table {table name}"

Reactivate the main plugin (Premium Exchanger) in the "Plugins" section.

Then, disable the update mode in the "Exchanger Settings" → "General Settings" section.

After this, the missing columns will be created in the table.


Site access unavailable

You need to locate the XXXX_options table in your database using PhpMyAdmin or Adminer and check the home and siteurl fields (they should contain your current domain). PhpMyAdmin can be installed in ISP Manager via the "Settings — Software Configuration" section. Check the box for "MySQL Administration Web Interface" and click "Install" above the table.


Clearing merchant logs and enabling auto-cleanup

Over time, the "Merchant Logs" and "Auto-Payout Logs" modules can accumulate a large number of logs, which may quickly fill up the database and cause errors on the site if log auto-cleanup is not enabled.

We recommend enabling logging only during the setup of merchant modules. Once the system is stable for receiving payments and auto-payouts, logging can be disabled.

You can configure automatic log cleanup in the "Settings - Logging Settings" section:

In the "Settings" → "Cron" section, copy the cron job link and create a cron job on your server following this guide (set the execution time to once every 24 hours or less frequently).

If logs are not cleared via the "Delete Logs" button in the corresponding section, you will need to clear them directly from the database.

Access the database via /Adminer and open the table (make sure to back up your database before clearing the table).

Go to the database web interface.

If the web interface is unavailable — enable access to it by following these steps:

To determine which firewall is installed on the server, log in as the root user in the ISPmanager panel, open the Shell console, and run the command ufw status numbered. If rules are displayed, disable them using the command ufw disable. After working with the database, re-enable the rules using the command ufw enable.

If the command Command 'ufw' not found is displayed, the rules are configured in iptables. To disable the rules there, run the command iptables -P INPUT ACCEPT && iptables -P FORWARD ACCEPT, and after working with the database, restart the server — the rules will be re-enabled automatically.

Locate the xxxx_merch_logs table (where xxxx is your table prefix).

Go to the "Operations" tab.

Clear the table by clicking "TRUNCATE."

Confirm the data deletion.

Repeat these steps for the table.


Error 404 when navigating to exchange direction page

Most likely, the "Hyphen in Exchange Direction" module is enabled in the "Modules" section, but the settings have not been saved to apply the changes. You can either disable it or leave it enabled (your choice).

Go to the "Settings → Permalinks" section and click the "Save Changes" button without making any changes on the page.

After this, check the display of exchange directions. If the changes are not immediately visible, clear the cache in Cloudflare (if you are using it).


Error 525 "SSL handshake failed" when accessing the site

The "SSL handshake failed" error indicates an issue establishing a secure connection between the client (usually a browser) and the server.

In your Cloudflare account settings, go to the "SSL/TLS" section and set the "Your SSL/TLS encryption mode" to "Flexible."


Admin panel errors after script update

Check the contents of the userdata.php file by following this guide.


Error in script.js file

If you encounter this error, disable js file caching in the site settings in ISP Manager.

In the "File Extensions for Caching" list, there should not be the js format (if it is present, remove it and save the settings).


Checking the size of database tables

If the site or admin panel starts to slow down, the issue may be caused by the growth of certain database tables (most often log tables).

To view the largest tables for subsequent cleanup, follow these steps:

In ISP Manager, go to the "Databases" section, select your database (copy the database name to a text file), and go to the "Users" section:

On the page, select the database owner and click "Edit."

Click the eye icon to view the user password. Save the username and password in a text file.

Go to the "Shell Client" section and enter the command mysql -u`` username ``-p, replacing username with the database username from the previous step. Execute the command, then enter the user password (characters will not be displayed as you type) and press Enter. Upon successful login, you will see the message "Welcome to the MySQL monitor."

Next, enter the command SELECT table_name AS "Table", round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" FROM information_schema.TABLES WHERE table_schema = "database_name" ORDER BY (data_length + index_length) DESC;, replacing database_name with your database name. Press Enter.

After completing these steps, a list of all tables sorted by size (largest tables at the top) will be displayed.


Redirecting to a subdomain when the main domain is blocked

First, add the subdomain to your license in the user account. Then, add the following block of code to the nginx configuration file (replace 123.ru and test.123.ru with your domain and subdomain):

server {
  server_name 123.ru;
  
  listen 80;
  
  location / {
    if ($argument_uri) {
      return 301 https://test.123.ru$request_uri;
    }
    
    ## remaining config here
  }
}

Here’s how it works: when a user accesses the site, the specified condition is checked. If the condition is met, a 301 redirect is performed, passing all request parameters (including affiliate link "tails").

The above example is for nginx; this configuration will not work in Apache.


System error (code: anticsfr)

As a quick temporary solution, simply refresh the page in your browser.

This error indicates an issue with session recording on the server or a change in the user's IP address. It’s likely that the session storage configuration is incorrect.

If sessions are being reset, you’ll need to adjust your PHP settings.

To resolve the issue, configure the session settings as shown in the screenshot below.

session.gc_probability and session.gc_divisor: These two parameters together determine the probability of triggering the garbage collection process on each request. The probability is calculated as gc_probability/gc_divisor. For example, if gc_probability is 1 and gc_divisor is 1000, garbage collection will be triggered on approximately 0.1% of requests.

session.gc_maxlifetime: This parameter defines the maximum session lifetime in seconds. If a session exceeds this time, it will be considered "garbage" and removed during the next garbage collection process.

After changing the PHP configuration, you must restart the web server for the changes to take effect.

To automate session cleanup, you can add two CRON jobs to run once a day:

Job 1:
find /var/www/*/data/mod-tmp/ -name "sess_*" -exec rm {} \;
Job 2:
find /var/www/*/data/bin-tmp/ -name "sess_*" -exec rm {} \;

Let me know if you need further refinements!

Script Control Panel or Website Freezing/Errors When Creating Requests

If the script's control panel or website is freezing, lagging, or displaying errors during request creation, follow these steps to troubleshoot and resolve the issue:


Session Deletion

To clear old sessions, execute the following commands via SSH:

  1. Navigate to the appropriate directory:

    cd /var/www/<your_website_user>/data
  2. Run the command to delete sessions older than 2 days:

    find mod-tmp -name "sess_*" -mtime +2 -type f -print0 | xargs -0rn 20 rm -f

This will remove all session files older than 2 days.

Additionally, you can check disk usage by opening another SSH session and running:

df -i

This command will display the disk's inode usage (the number of files). Depending on your server's configuration, clearing sessions may take anywhere from 10 minutes to 5 hours.


Server Configuration Settings

Check the Settings -> Cron section to ensure the settings match the provided instructions. If you’ve modified these settings previously, revert them to their original state.


PHP Configuration

  1. Log in to the ISP Manager control panel as the root user and verify the PHP version used by your website.

    PHP Version Check
  2. Open the settings for the required PHP version.

    PHP Settings
  3. Ensure the following parameters are set as shown in the screenshot. If they differ, update them accordingly.

    PHP Parameters
  4. To fully clear temporary files, run:

    find mod-tmp -name "sess_*" -type f -print0 | xargs -0rn 20 rm -f

After completing these steps, temporary files will be removed, and PHP will handle automatic file cleanup.


Increasing Memory Limit

If the script processes large amounts of data, it may require more memory than currently allocated. To increase the memory limit:

  1. Open the wp-config.php file for your domain and add the following lines after:

    define('WP_DEBUG', false);
    define('WP_MEMORY_LIMIT', '512M');
    define('WP_MAX_MEMORY_LIMIT', '1024M');
  2. Update your server configuration to set:

    MEMORY_LIMIT = 512M
    Memory Limit

Switching the Geo IP Service

To improve IP-based country detection:

  1. Go to the GEO IP -> IP Detection Settings section.

  2. Change the source to sypexgeo.net.

  3. Set the timeout to 7 seconds and save the changes.

    Geo IP Settings

Admin Panel and Server Actions

  1. Disable all modules in the Modules section (make note of their current state beforehand). Check if the website runs faster.

  2. If performance improves, re-enable the modules gradually (3-5 at a time) and identify which module causes the slowdown.

  3. If the module \wp-content\plugins\premiumbox\moduls\courselogs exists, consider removing it, as it may heavily impact system performance.

If none of the above steps resolve the issue, contact your hosting provider's technical support team. Request a server load analysis and diagnostic report.


Increasing Maximum File Upload Size

To allow users to upload larger files (e.g., for account or identity verification):

  1. By default, the upload limit is 2 MB. To increase it:

    • If using ISP Manager, log in as the root user and navigate to PHP Settings.

    • Select the PHP version used by your website and adjust the Max File Size option.

      PHP File Size Settings
  2. Alternatively, edit the php.ini file directly and update the following directives:

    upload_max_filesize = 128M
    post_max_size = 128M
    memory_limit = 256M
    max_execution_time = 300
    max_input_time = 300
    • upload_max_filesize: Set to a value larger than your backup file size.

    • post_max_size: Set to a value larger than your backup file size.

    • memory_limit: Ensure it exceeds your backup file size.

    • max_execution_time: Set to 0 for unlimited execution time.

  3. Restart the server after making these changes.

If you encounter errors after increasing the file size limit, refer to the official PHP documentation for troubleshooting.


Setting the "Under Review" Status

  1. In the settings for all merchant modules, locate the Request Status Handling section. Select Under Review for all options and save the changes.

    Merchant Status Settings
  2. In the settings for all auto-payout modules, disable payouts for requests with the Under Review status by selecting No for the relevant option.

    Auto-Payout Settings

DNS Records for Email Configuration

If you need to troubleshoot email-related issues, refer to this DNS configuration cheat sheet for SPF, DKIM, DMARC, and other email verification records.


Additional Resources

Last updated