ERR_SSL_PROTOCOL_ERROR on Subdomains for Laravel Multi-tenant App (stancl/tenancy, Single DB) on Hostinger

I’ve deployed a multi-tenant Laravel application using the stancl/tenancy package. It’s configured with a single database and hosted on Hostinger’s hPanel business plan.

The application works perfectly fine on the central domain (e.g., maindomain.com). However, when I try to access any of the tenant subdomains (e.g., tenant1.maindomain.com, tenant2.maindomain.com), I encounter the ERR_SSL_PROTOCOL_ERROR in my browser.

Here’s a summary of my setup:

Laravel Version: (Specify your Laravel version here)
stancl/tenancy Version: (Specify your stancl/tenancy version here)
Database: Single database for all tenants.
Hosting: Hostinger hPanel business.
SSL: I have an SSL certificate installed for my main domain (and I believe it should cover subdomains).
Things I’ve already checked/tried:

Ensuring the central domain has a valid SSL certificate.
Checking the Hostinger SSL settings for the domain and subdomains.
Reviewing my Laravel and tenancy configuration files (though I’m not sure what to look for regarding SSL on subdomains).
Clearing browser cache and trying different browsers.
The fact that the central domain works correctly suggests the base SSL setup might be okay, but there seems to be an issue specifically with the subdomains.

Has anyone encountered this issue before with stancl/tenancy and Hostinger (or similar setups)? Any insights or troubleshooting steps would be greatly appreciated. I’m not sure where to look next to resolve this SSL error on my tenant subdomains.

Thank you in advance for your help!

Please remember to replace the placeholders for Laravel and stancl/tenancy versions with your actual versions. You might also want to include relevant snippets from your config/tenancy.php file if you think they might be related (be careful not to expose any sensitive information). Good luck!

PHP class not found when using name spacing

I am trying to load my class through namespacing but Im struggling to find the right configuration and I keep getting a class not found error.

Here is the psr-4 property in my composer.json

"psr-4": {
    "Namespaceone\": [
        "src/core/Modules/Moduleone",
        "src/core/Modules/Moduletwo",
    ],
    "Volvo\": [
        "src/programme/volvo/",
        "src/programme/volvo/volvoxc"
    ]
}

Here is the file structure of src/programme/volvo:

- init.php  //Contains new Volvo()
- Volvo.php //Class Volvo
- volvoxc/
  - Volvoxc.php //Class Volvoxc extends Volvo

The files and classes:

init.php

$volvo = new Volvo(); //This returns all the properties from Volvo()

Volvo.php

namespace Volvo;
use Volvoxc;
class Volvo {
  $volvoxc = new Volvoxc();
}

Volvoxc.php //This class can not be found

namespace Volvo;
class Volvoxc extends Volvo {}

How to turn a PHP generated page dark? [duplicate]

I’m serving a dead simple page on the raspberry:

<?php
 
 
require 'Parsedown.php';  # A markdown parser.
 
 
$h = date('H');
if( $h < 5 )
{
    $pic = 'res/cyber_rat.png';
}
elseif( $h < 11 )
{
    $pic = 'res/day_rat.png';
}
elseif( $h < 20 )
{
    $pic = 'res/saint_rat.png';
}
else
{
    $pic = 'res/asm_rat.png';
}
 
$readme = file_get_contents('/opt/rat/README.md');
 
# As a text file
#$readme_html = nl2br(htmlspecialchars($readme));  # Convert line breaks and escape HTML
 
# Or as parsed markdown.
$Parsedown = new Parsedown();
$readme_html = $Parsedown->text($readme);  # Convert Markdown to HTML
 
 
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>rat</title>
    <link rel="icon" type="image/png" href="res/icon.png">
</head>
<body>
    <img src="<?php echo $pic; ?>" alt="Saint Rat" style="max-width: 100%; height: auto;" />
    <pre><span class="inner-pre" style="font-size: 14px"><?php echo $readme_html; ?></span></pre>
 
</body>
</html>

Any idea how to turn this into something a visitor would experience if they were using a “dark theme” browser plugin?

Unable to run Laravel Apps on latest Ubuntu 25.04 [closed]

Yesterday, I upgraded my Ubuntu 24 to 25.04, which I should not have. Now I am not able to run Laravel Applications. Apache2 is having troubles, I guess. Says could not find driver, but I have mysql and pdo_mysql installed. Everything is installed as required for Laravel to run, but I am still getting this error. Help appreciated.

Tutorial for Google sign in using FedCM [closed]

I’ve gotten Google sign-in working on a sample Android app so wanted to get it to work for a web app as well. For this, I am using core-PHP, without Laravel, CI or any other framework. As per the documentation, the Google Sign-in Library is deprecated and I should be using FedCM API’s.

I have read the migration guide and blogs on FedCM, but as yet haven’t been able to find any tutorial on how to implement FedCM. Can someone kindly point me towards one?

wordpress wpml translation for custom post

I’ve created a custom post submission form for a specific category on my WordPress site. The form works fine for submitting posts, but there’s an issue with translation.

When a user submits a post using the form, the post is created but not translated immediately. However, if I then manually edit and save the post from the backend, it automatically gets translated as expected.

It seems like the translation is only triggered when a post is updated, not on the initial submission.

What I’ve tried so far:

Checked the form code and confirmed the correct category is assigned.

Verified that translation settings are working correctly for posts submitted through the WordPress dashboard.

Looked into hooks like save_post and wp_insert_post, but haven’t been able to trigger the translation on submission.

Customise Express Check Out Screen using NVP/SOAP

Is it possible to customise the Express Checkout screen when calling it with API, e.g SetExpressCheckout, GetExpressCheckoutDetails, DoExpressCheckoutPayment

Ideally I would like to:

  1. Add my own image
  2. Remove the shipping details
  3. Restrict the payment options to PayPal Balance only
    3.1. Remove any card details
    3.2. Remove the ‘Link credit or debit card’ option
    3.3. Remove the ‘Pay in 4’ option
  4. Modify the ‘Cancel and return to ‘ link text

I have located express checkout variables but I am unable to use them in code, i.e. they have no effect. Having spent a few hours searching the web I am under the impression that customising the checkout experience is only possible with buttons created in the Paypal account

Output is ignoring decimal part using bcdiv

Code:

<?php
$a = "38.5";
$result = bcdiv(bcadd($a, "6"), "2", 100);
echo $result;
?>

Showing output:

22.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Expected output:

22.2500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Calculating VAT & Gross amounts from a single echo $row[‘Net Amount’} from Mysqli Data – ONLY 2 decimal places

I have a php input form that I enter a ‘Net Price’ into mysql.

I have a seperate page that pulls that data into a table in a ‘Quotations’ page via ‘echo’.

I am trying to ‘automatically’ calculate VAT and Total amounts from the ‘Net Price’, which I can do via “$row[“Net_Price”]*0.2″ & “$row[“Net_Price”]*1.2″ but I cannot get it to display to only 2 decimal places (always shows 3).

Have tried adding javascript to the “” through research on here like the below:

echo"<td onchange='(function(el){el.value=parseFloat(el.value).toFixed(2);})(this)'>£ " . $row["Net_Price"]*0.2. "</td>";

Unsure if this is an impossible method, or if I should be attacking this differently, so help is appreciated.

Curl to display single value from SMM API in PHP [duplicate]

I am trying to display just part of the retrived info from an API using curl.

Here is the code:

<?php
$post = [
    'key' => 'fcee257155122a62dce9c75f4995db46',
    'action' => 'balance'
];
$ch = curl_init('https://smmpanelserver.com/api/v2');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// execute!
$response = curl_exec($ch);
// close the connection, release resources used
curl_close($ch);
// do anything you want with your response
var_dump($response);
?>

Here is the result:

string(40) "{"balance":"0.7287160","currency":"USD"}"

I want to display only:

0.7287160

How to do that?

Issue in pagination with AJAX loading

I am trying to integrate pagination with search option using the AJAX method. When user search something or navigate the pages, instead of submitting the form and reloading the whole page again, I want to load the filtered list inside my view page. Even if there is some search filtering, user should be able navigate through pages(1, 2, 3..) using AJAX loading.

But I am not sure, how can I use the loadList() function in the pagination links which is automatically generated in codeigniter 4.

When I load the URL: http://localhost:8080/admin/test , it works fine.
When I click on the page links in the bottom, it is navigating to URL: http://localhost:8080/admin/test-list?filter_name=&filter_value=&page=4

I want to prevent this and instead, the javascript function: loadList(<page_number>) with corresponding page number should be the navigation link.

I have the following scripts in my CodeIgniter 4 application:

My main view page(test.php) is like this:

<div class="container" style="margin-top: 70px;">
<div class="row justify-content-center">
<div class="col-sm-12">    

    <div class="row">
        <div class="col-3">
            <select id="filter_name" class="form-select mb-3">
                <option value=""> -- Choose Filter -- </option>
                <option value="location">Location</option>
                <option value="region">Region</option>
                <option value="emirate">Emirate</option>
            </select>
        </div>
        <div class="col-3">
            <input type="text" placeholder="Enter Search Text" class="form-control" id="filter_value" />
        </div>
        <div class="col-3">
            <input type="button" class="btn btn-primary" value="Search" onclick="loadList()" />
        </div>
    </div>

    <div class="form-group">
        <div class="text-center">
            <div class="loaderImg" style="display: none;">
                <i class="fa fa-spinner fa-spin"></i> <small>Please wait ...</small>
            </div>
        </div>
    </div>

    <div id="list_strip">&nbsp;</div>

</div>
</div>
</div>


<script>
function loadList() {
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });

    $.ajax({
        url: "<?= site_url('/admin/test-list') ?>",
        data: {
            filter_name: document.getElementById("filter_name").value,
            filter_value: document.getElementById("filter_value").value,
        },
        beforeSend: function() {
            $(".loaderImg").show();
        },
    })
    .done(function(result) {
        $("#list_strip").html(result);
    })
    .fail(function(jqXHR, textStatus, error) {
        $("#list_strip").html(error);
    })
    .always(function() {
        $(".loaderImg").hide();
    });
}

$(document).ready(function() {
    loadList();
});

</script>

I have a AJAX listing page(test_ajax.php) which is loading inside the view is as shown:

<div class="row">
    <div class="col-12 text-end">Total Rows: <?= $recordCount ?></div>
</div>

<div class="d-flex flex-md-row w-100 py-3 fw-bold">
    <div class="flex-column col-4">Location</div>
    <div class="flex-column col-3">Region</div>
    <div class="flex-column col-3">Emirate</div>
    <div class="flex-column col-2">&nbsp;</div>
</div>

<div class="tableStripe">
    <?php foreach($locations as $eachItem): ?>
    <div id="listRow_<?= $eachItem['location_sl_no'] ?>" class="tableRow d-flex flex-md-row w-100 py-1 my-2 align-items-center rounded">

        <div class="flex-column col-4"><?= $eachItem['location_name'] ?></div>
        <div class="flex-column col-3"><?= $eachItem['region'] ?></div>
        <div class="flex-column col-3"><?= $eachItem['emirate'] ?></div>
        <div class="flex-column col-2">&nbsp;</div>
    </div>
    <?php endforeach; ?>
</div>

<?= $pager->links() ?>

And the Controller file(Admins.php) as follows:

...

public function testList() {
        if(!session()->get('isAdminLoggedIn')) {
            return redirect()->to('/admin/login'); // goto login page, if not loggedin
        }

        $data = [];

        echo view('components/admin_header', $data)
            . view('admin/test')
            . view('components/admin_footer');
    }


    public function testListAJAX() {
        $filterName = $this->request->getGet('filter_name');
        $filterValue = $this->request->getGet('filter_value');

        // $model = model(LocationModel::class);
        $model = new LocationModel();

        if($filterName != "" && trim($filterValue) != "") {
            $model->like($filterName, trim($filterValue));
        }

        $data = [];
        $data['recordCount'] = $model->countAllResults(false);
        $data['locations'] = $model->paginate(5);
        $data['pager'] = $model->pager;

        echo view('admin/test_ajax', $data);
    }

...

And the AppConfigRoutes.php file is as follows:

$routes->get('/admin/test', 'Admins::testList');
$routes->get('/admin/test-list', 'Admins::testListAJAX');

Can anyone guide me, how to fix this issue?

Run command as sudo with php exec with provided password

I have a small php website and want to run a script via button press. On the website I have an input for a password and I want to use that password for sudo authentification. (I don’t want to change permissions somewhere to make this work. I just want to use plain sudo auth.)

I have this php script:

exec('echo "' . $request['password'] . '" | sudo -S /usr/local/bin/mycommand  2>&1', $output, $retval);

But this doesn’t seem to work. I can run this script without problems via console but just not via php. I also tried to hardcode the password rule out errors within the request but that also doesn’t work.

Those are the errors I get via php:

0   "[sudo] password for www-data: Sorry, try again."
1   "[sudo] password for www-data:"
2   "sudo: no password was provided"
3   "sudo: 1 incorrect password attempt"

What’s the error here?

Trouble accessing wp-config.php file

My wordpress site is receiving the following error – ‘ERR_TOO_MANY_REDIRECTS’

  • I have figured out that I need to remove duplicate WP_Cache definitions from my wp-config.php file but I do not know how to access it.

I have taken over this site from a past employee and I dont if they used an FTP Client. And I do not have access to the wordpress site.

Any ideas on what to do? All help appreciated.

Kind regards,

Is unset in php is associated with clearstatcache()

I am using unset in php array to delete items in the array

My question is clearstatcache() works after using unset or it is just files?

In my experiment using clearstatcache() after unset fix my warnings or maybe it was not the clearstatcache() that fix those warnings?