Empty Server response sometimes in in Chrome

I have a strange issue on a website for a customer. He is hosting via GoDaddy.

Some context:
It is a custom WordPress site fetching content via Ajax to load into the page.

Problem statement:
When testing, I noticed some random occurrences for empty responses coming back from the server. Triggering the same request over and over, it happens that the response header is empty. This is strange as I had performed the same test seconds / minutes before.

This is the result of a successful response:

{"finishTitle":"Bourland 2","finishNumber":"VP2","highlightImage":"https://qdr.app/wp-content/uploads/2024/08/leathershandtas6-320x202-1.jpg","galleryImages":"<img src="https://qdr.app/wp-content/uploads/2024/08/leathershandtas6-320x202-1-150x150.jpg" class="selectedFinishImage" data-large-src="https://qdr.app/wp-content/uploads/2024/08/leathershandtas6-320x202-1.jpg" alt="" /><img src="https://qdr.app/wp-content/uploads/2024/08/leathershandtas3-320x202-1-150x150.jpg" data-large-src="https://qdr.app/wp-content/uploads/2024/08/leathershandtas3-320x202-1.jpg" alt="" /><img src="https://qdr.app/wp-content/uploads/2024/06/8CCL-Basement-Office-Doors-Looking-at-Egress-150x150.jpg" data-large-src="https://qdr.app/wp-content/uploads/2024/06/8CCL-Basement-Office-Doors-Looking-at-Egress-1024x681.jpg" alt="" /><img src="https://qdr.app/wp-content/uploads/2024/08/leathershandtas5-320x202-1-150x150.jpg" data-large-src="https://qdr.app/wp-content/uploads/2024/08/leathershandtas5-320x202-1.jpg" alt="" />"}

With a response header looking like this:
response header successful response

Result from an empty response:

The response itself is empty.

We have the following response headers. You can see the difference.

response header empty response

What could cause this and how can it be solved?

Prestashop import, manage and update 8000+ products and 400+ categories from CSV

I have a Prestashop installation and I have a CSV file with 8000+ products with 400+ categories in it. Each product has no variants but has like 10 images. This CSV changes everyday, it contains new products, erased products (SKU not anymore in the CSV), and several random updates of any value in it (prices, quantities, descriptions, SKU, etc).

The best solution should be whole import of the CSV each day, but looks like being impossible.

Since now I have made a PHP script that reads the CSV and outputs another CSV, that meets the Prestashop import in the admin backend. I have imported this huge CSV in steps of few hundred products.

Then I wrote another PHP script that everyday reads the original CSV and then changes some values inside the PS database (quantity, price, etc), getting the SKU as a reference. If the SKU is not present (so is a new product) it outputs another CSV with new products to import. That import has to be made manually in the PS admin > import csv.

Since now it is working fairly well, but it has many limitations, needs daily supervision and intervention, and is virtually impossible to check that all the 8000 products are really updated.

My question is, is there a better way to manage all this database? As I said, the best solution should be to rewrite all the product database each day, but I did not find any way to this solution.

I have tested the Prestashop Webservice but not working properly also for the amount of products.

(I don’t know also if Prestashop is the right solution, I was even thinking about writing a PHP product catalogue based on the original CSV and add PayPal “add to cart” functions)

Only one row showing on my php mysql select

This is my code, it’s a dashboard that shows data grabbed from mysql database. The tables in the database are correctly populated, all the data is actually there. But the page only shows the first row.

<html>
<HEAD>
    <style>
        a:link, a:visited {
            background-color: #D80D30;
            color: white;
            padding: 15px 25px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
        }

        a:hover, a:active {
            background-color: red;
        }
        myTable {
            
        }
        th { 
            position: sticky; 
            top: 0; 
            background-color: white;
        }
        td {
            padding: 5px;
        }
        tr {
            border-bottom: 1px solid #ddd;          
        }
        
        tr.header, tr.hover {
            background-color: #f1f1f1;
        }
                    img.center {
                display: block;
                margin-left: 0;
                margin-right: 0;
                border: 0;
                width: 100%;
                height: 100%;
                align-content: right;
                align-self: right;
                background-color: transparent;
            }
            a.a2 {
                background-color: transparent;
                text-align: right;
                padding: 0px 0px;
                position: fixed;
                bottom: 10px;
                right:0px;
                z-index: 20;
                width: 50px;
                height: 50px;
            }
    </style>
    <script>
    function myFunction()
    {
        // Declare variables
        var input, filter, table, tr, td, i, txtValue;
        input = document.getElementById("myInput");
        filter = input.value.toUpperCase();
        table = document.getElementById("myTable");
        tr = table.getElementsByTagName("tr");

        // Loop through all table rows, and hide those who don't match the search query
        for (i = 1; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[0];
            if (td) {
                txtValue = td.textContent || td.innerText;
                if (txtValue.toUpperCase().indexOf(filter) > -1) {
                    tr[i].style.display = "";
                } else {
                    tr[i].style.display = "none";
                }
            }
        }
    }
    function myFunction2()
    {
        // Declare variables
        var input, filter, table, tr, td, i, txtValue;
        input = document.getElementById("myInput2");
        filter = input.value.toUpperCase();
        table = document.getElementById("myTable");
        tr = table.getElementsByTagName("tr");

        // Loop through all table rows, and hide those who don't match the search query
        for (i = 1; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[1];
            if (td) {
                txtValue = td.textContent || td.innerText;
                if (txtValue.toUpperCase().indexOf(filter) > -1) {
                    tr[i].style.display = "";
                } else {
                    tr[i].style.display = "none";
                }
            }
        }
    }
    function myFunction3()
    {
        // Declare variables
        var input, filter, table, tr, td, i, txtValue;
        input = document.getElementById("myInput3");
        filter = input.value.toUpperCase();
        table = document.getElementById("myTable");
        tr = table.getElementsByTagName("tr");

        // Loop through all table rows, and hide those who don't match the search query
        for (i = 1; i < tr.length; i++) {
            td = tr[i].getElementsByTagName("td")[2];
            if (td) {
                txtValue = td.textContent || td.innerText;
                if (txtValue.toUpperCase().indexOf(filter) > -1) {
                    tr[i].style.display = "";
                } else {
                    tr[i].style.display = "none";
                }
            }
        }
    }
    </script>
    <datalist id="type">
        <option value="AdapterAllianz">
        <option value="AdapterCarige">
        <option value="AdapterCedacri">
        <option value="AdapterCompass">
        <option value="AdapterEurizon">
        <option value="AdapterING">
        <option value="AdapterISP">
        <option value="Auth">
        <option value="CR296">
        <option value="DR">
        <option value="Email">
        <option value="ISP">
        <option value="Mask">
        <option value="MO">
        <option value="MT">
        <option value="MTOTP">
        <option value="MultiEmail">
        <option value="MultiMT">
        <option value="PaydoCloud">
        <option value="Push">
        <option value="WAC">
        <option value="WACIO">
        <option value="WAT">
    </datalist>
    </HEAD>
<body>
    <h1>INTEGRATION</h1>
<h2><a href="index.html">HOME</a><BR></h2>

<form action="update_int_notest.php" method="get">
    <select name="type">
        <option value="ALL" selected>ALL</option>
        <option value="AdapterAllianzListenerSEC">AdapterAllianzListenerSEC</option>
        <option value="AdapterAllianzListenerSIA">AdapterAllianzListenerSIA</option>
        <option value="AdapterCarige">AdapterCarige</option>
        <option value="AdapterCedacri">AdapterCedacri</option>
        <option value="AdapterCompass">AdapterCompass</option>
                <option value="AdapterEurizon">AdapterEurizon</option>
        <option value="AdapterING">AdapterING</option>
        <option value="AdapterISP">AdapterISP</option>
        <option value="Auth">Auth</option>
        <option value="CR296">CR296</option>
        <option value="DR">DR</option>
        <option value="Email">Email</option>
        <option value="ISP">ISP</option>
        <option value="Mask">Mask</option>
        <option value="MO">MO</option>
        <option value="MT">MT</option>
        <option value="MTOTP">MTOTP</option>
        <option value="MultiEmail">MultiEmail</option>
        <option value="MultiMT">MultiMT</option>
        <option value="PaydoCloud">PaydoCloud</option>
        <option value="Push">Push</option>
        <option value="WAC">WAC</option>
        <option value="WACIO">WACIO</option>
        <option value="WAT">WAT</option>
        <option value="ubmApi">ubmApi</option>
        <option value="ubmMT">ubmMT</option>
        <option value="ubmRejected">ubmRejected</option>
        <option value="ubmAdapters">ubmAdapters</option>
        <option value="ubmMail">ubmMail</option>
        <option value="ubmWA">ubmWA</option>
    </select>
    <br>
    <p>Select refresh type:</p>
        <input type="radio" id="incremental" name="range" value="incremental" checked>
        <label for="incremental">Incremental</label><br>
        <input type="radio" id="full" name="range" value="full">
        <label for="full">Full</label><br>
    <br>
    <input type="submit" value="Refresh Data"/>
</form>


<table id="myTable" border="3" BORDERCOLOR=#F4982B>
<thead>
    <tr >
        <th><input list="type" id="myInput" onkeyup="myFunction()" placeholder="Search for type.."></th>
        <th><input id="myInput2" onkeyup="myFunction2()" placeholder="Search for ID.."></th>
        <th><input id="myInput3" onkeyup="myFunction3()" placeholder="Search for name.." width=100%></th>
        <th align="center"><?php $date5 = date('d-m-Y',strtotime("-4 days"));print($date5); ?><br>
        <a href="fail_int_filter_new.php?date=<?php print($date5); ?>">Filter</a></th>
        <th align="center"><?php $date4 = date('d-m-Y',strtotime("-3 days"));print($date4); ?><br>
        <a href="fail_int_filter_new.php?date=<?php print($date4); ?>">Filter</a></th>
        <th align="center"><?php $date3 = date('d-m-Y',strtotime("-2 days"));print($date3); ?><br>
        <a href="fail_int_filter_new.php?date=<?php print($date3); ?>">Filter</a></th>
        <th align="center"><?php $date2 = date('d-m-Y',strtotime("-1 days"));print($date2); ?><br>
        <a href="fail_int_filter_new.php?date=<?php print($date2); ?>">Filter</a></th>
        <th align="center"><?php $date1 = date('d-m-Y');print($date1); ?><br>
        <a href="fail_int_filter_new.php?date=<?php print($date1); ?>">Filter</a></th>  
        <th align="center">Note</th>
        <th align="center">Insert</th>
        <th align="center">Delete</th>
    </tr>
</thead>
<?php
$servername = "localhost";
$username = "automation";
$password = "Kaleyra1!";
$dbname = "automation";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql_tests ="SELECT DISTINCT t.ID, h.test_type, h.test_name FROM int_tmp h left join testID_1 t on h.test_name=t.Name ORDER BY `t`.`ID`, h.test_type, h.test_name  DESC";
$res_tests = $conn->query($sql_tests);
$date=date('Y-m-d',strtotime("-4 days"));
$sql_hist ="SELECT test_name, test_status, test_runtime FROM int_tmp where test_runtime > date("".$date."") order by test_runtime";
$res_hist = $conn->query($sql_hist);
$sql_bugs ="SELECT DISTINCT test_name,bug_id from bugs;";
$res_bugs = $conn->query($sql_bugs);
$sql_note="SELECT test_name,nota,insert_date from int_note ORDER BY insert_date desc";
$res_note=$conn->query($sql_note);

while ($test=$res_tests->fetch_assoc()) {
    print("<tr><td>".$test["test_type"]."</td>");
    print("<td>".$test["ID"]."</td>");
    print("<td style="text-align:left">".$test["test_name"]."</td>");
    for ($i=4;$i>=0;$i--) {
        $present=FALSE;
        while ($row = $res_hist->fetch_assoc()) {
            if ($test["test_name"]==$row["test_name"] AND date('d-m-Y',strtotime($row["test_runtime"]))==date('d-m-Y',strtotime("-".$i." days"))) {
                print("<td align="center"><img src="./img/".$row["test_status"].".png" width="30" height="30" ><br>".substr($row["test_runtime"],-8)."</td>");
                $present=TRUE;
            }
        }
        if ($present==FALSE) {
            print("<td></td>");
        }
        $res_hist->data_seek(0);
    }
    print("<td>");
    while ($bug = $res_bugs->fetch_assoc()) {
        if ($bug["test_name"]==$test["test_name"]) {
            print("<a href=https://kaleyra.atlassian.net/browse/".$bug["bug_id"].">".$bug["bug_id"]."</a><br>");
        }
    }
    $res_bugs->data_seek(0);
    while ($note = $res_note->fetch_assoc()) {
        if ($note["test_name"]==$test["test_name"]) {
            print($note["nota"]." - ".$note["insert_date"]."<br>");
        }
    }
    $res_note->data_seek(0);
    print("</td>");
    print("<td><a href="ins_int.php?type=".$test["test_type"]."&name=".$test["test_name"]."" target="new">Insert</td>");
    print("<td><a href="del_int.php?type=".$test["test_type"]."&name=".$test["test_name"]."" target="new">Delete</td>");
    print("</tr>");
}




$conn->close();
?>
</table>
<a href="#top" class="a2"><img src="img/red-arrow.png" class="center"/></a>
</body>
</html>

The tables are correctly populated, but only the first row shows. I have tried multiple solutions, but can’t come up with a fix. It worked fine until early this morning, but now I can’t get it to show all the rows.

String folder structure with all matching folders listed

I’ve been trying to do this for a few days and really I’m struggling. How do I generate all possible scanned folders from the string below and replace all possible folders in %%%ANY_DIR%%%?

$multiple_folder_scan_structure = "Customers/%%%ANY_DIR%%%/HW/%%%ANY_DIR%%%/XR7 and XR7 plus (7702 and 7703)";

The expected output should list all possible complete folder paths found within the defined structure above. With one %%%ANY_DIR%%% this is easy, but with 2 or 3, I’m completely lost as to how to accomplish this.

An example of the expected array would like something like this:

../../Customers/Morrisons/HW/SS90 Card Only (7709)/XR7 and XR7 plus (7702 and 7703)
../../Customers/Morrisons/HW/Test/XR7 and XR7 plus (7702 and 7703)
../../Customers/Sainsbury's/HW/SS90 Card Only (7709)/XR7 and XR7 plus (7702 and 7703)
../../Customers/Tesco/HW/SS90 Card Only (7709)/XR7 and XR7 plus (7702 and 7703)

I have tried to below among other codes, but it clashes as soon as I scan the first %%%ANY_DIR%%%, then the variable I use suddenly isn’t linear. I feel I should implement a dynamic loop (maybe While), but I’m clueless.
I use my “scan_dir_sorted” function here that scans any folder and puts it into an array.

      $multiple_folder_scan_structure_anydir_exp = explode('/', $multiple_folder_scan_structure);
      
      $any_dir_counter = 0;
      foreach ($multiple_folder_scan_structure_anydir_exp as $folder)  {
        if (strtoupper($folder) == "%%%ANY_DIR%%%")  {
          //echo $multiple_folder . "<br>";
          
            foreach (scan_dir_sorted($multiple_folder) as $any_dir)  {
              //echo $multiple_folder . $any_dir . "<br>";
              $any_dir_scanned_folders[$any_dir_counter][] = $any_dir;
            
            }
          $any_dir_counter++;
          $multiple_folder .= $folder . "/";
        }
        else
          $multiple_folder .= $folder . "/";
      }

Any help is appreciated.

Thanks

Empty data returned using method listDomainsTrafficStats when spam rate has no value

I have create a page to retrieve Google Postmaster data using API calls on a PHP file. The method works well and I’m getting the data that I want however I have realised that as soon as a subdomain has no data in spam rate for example, the method returns nothing despite the fact that this subdomain ($domainGoogleName) still has IP reputation or domain reputation for that specific day.

// Create Postmaster Tools service
$postmasterService = new PostmasterTools($client);
try{
$trafficStats = $postmasterService->domains_trafficStats->listDomainsTrafficStats($domainGoogleName,
                        [
                            "startDate.day" => [intval($startDay)],
                            "startDate.month" => [intval($startMonth)],
                            "startDate.year" => [intval($startYear)],
                            "endDate.day" => [intval($endDay)],
                            "endDate.month" => [intval($endMonth)],
                            "endDate.year" => [intval($endYear)],
                        ]);
if (count($trafficStats->getTrafficStats()) === 0) {
echo "NO DATA";
} else {
foreach ($trafficStats->getTrafficStats() as $stat) {
echo $stat->getDomainReputation();
echo $stat->getDkimSuccessRatio();
echo $stat->getUserReportedSpamRatio();
etc
...
}
}
                } catch (Exception $e) {
                    echo $e->getMessage();
                
                }

Would you know why Google doesn’t return anything even-though I know there is data?
Thanks

I have tried to change the date to pull the data, tried to add an if to check if there is value but my algorithm doesn’t even display “NO DATA”

Json_decode display field start chronological order

How can I arrange the date (start) in chronological order when displaying a json file with several fields?

This is the json file:

{
"0": { 
"id": 1, 
"rid": 1, 
"eventType": "Rendez-vous simple", 
"title": "CONGES PAYES", 
"description": "", 
"start": "01-01-2024 00:00:00", 
"end": "06-01-2024 00:00:00", 
"color": "#000" 
}, 
"1": { 
"id": 2, 
"rid": 2, 
"eventType": "Rendez-vous simple", 
"title": "CARGILL Za 44000 MONTOIR", 
"description": "[R\u00e9f:6201]", 
"start": "16-01-2024 08:00:00", 
"end": "16-01-2024 10:00:00", 
"color": "#CF00F4" 
}, 
"2": { 
"id": 3, 
"rid": 3, 
"eventType": "Rendez-vous simple", 
"title": "ADMINISTRATIF", 
"description": "", 
"start": "08-01-2024 00:00:00", 
"end": "13-01-2024 00:00:00", 
"color": "#FF8C00" 
} 
}

sort(), usort(), asort()?

Pagination in WordPress is not working, second page loads wrong template

I have problems with my pagination. On the first page 5 posts are correctly displayed on the correct template archive-buch.php and also the pagination button, the next page is empty and a wrong template, index.php is loaded.
The existing posts for this problem have not helped me.
I am grateful for any help.

First here my screenshots:
correct template with data

wrong template no data

Here ist my archive-buch.php

    <?php get_header(); ?>

<?php
// Anzahl der Posts pro Seite
$posts_per_page = 5;  // Anzahl der Beiträge pro Seite
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;  // Aktuelle Seite

/*
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; } */


// WP_Query für den Buch-Post-Typ
$args = array(
    'post_type' => 'buch',   // Custom Post Type „buch“
    'posts_per_page' => $posts_per_page,   // Anzahl der Bücher pro Seite
    'paged' => $paged,       // Aktuelle Seite setzen
    'offset' => $posts_per_page * ($paged - 1)
);

// Neue Abfrage erstellen
$query = new WP_Query( $args );

// Debugging - Query überprüfen
/*
echo '<pre>';
print_r( $query );
echo '</pre>';
*/

if ( $query->have_posts() ) : 
    while ( $query->have_posts() ) : $query->the_post(); ?>

        <!-- Ausgabe des Buch-Titels und Inhalts -->
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
            <div><?php the_excerpt(); // Ausgabe des Auszugs ?></div>
        </article>

    <?php endwhile; ?>

    <!-- Pagination -->
    <div class="pagination">
        <?php
        // Vorherige Seite (Link zur vorherigen Seite anzeigen)
        previous_posts_link( '« Vorherige Seite' );

        // Nächste Seite (Link zur nächsten Seite anzeigen)
        next_posts_link( 'Nächste Seite »', $query->max_num_pages );
        ?>
    </div>

<?php else : ?>
    <p>Keine Bücher gefunden.</p>
<?php endif; ?>

<?php
// Reset der Query-Daten
wp_reset_postdata();
?>

<!-- Footer -->
<footer>
    <p>&copy; <?php echo date('Y'); ?> - Alle Rechte vorbehalten.</p>
</footer>

<?php wp_footer(); ?>

And here part of my functions.php

function create_buch_post_type() {
    $args = array(
        'label'             => 'Bücher',
        'public'            => true,
        'has_archive'       => true, // Stellt sicher, dass ein Archiv vorhanden ist
        'rewrite'           => array( 'slug' => 'buecher' ),  // Rewrite-URL korrekt setzen
        'supports'          => array( 'title', 'editor', 'excerpt' ),
    );
    register_post_type( 'buch', $args );
}
add_action( 'init', 'create_buch_post_type' );

Any help is appreciated

Codeigniter 3 edit and delete user details from database by admin role

I am creating a web application using codeigniter 3. I have created the database and views and models for user and for admin also now i stucked at some point where i need to give permission to admin so that he can delete a user information or can update it. How to do this.

Here is my edit controller view and model code respectively

//#### User Edit Controller

load->model(‘User_model’); // Correct model loading
$this->load->helper(‘url’); // Load the URL helper
$this->load->library(‘form_validation’); // Load form validation library
}

// Display the edit form with user details
public function edit_user($userid) {
$data[‘user’] = $this->User_model->get_user_by_userid($userid); // Get user data based on userid
if (!$data[‘user’]) {
show_404(); // Show 404 if user not found
}
$this->load->view(‘update_user’, $data); // Load view with user data
}

// Update user details in the database
public function update_user($userid) {
// Set form validation rules
$this->form_validation->set_rules(‘userid’, ‘User ID’, ‘required’);
$this->form_validation->set_rules(‘role’, ‘Role’, ‘required’);
$this->form_validation->set_rules(‘password’, ‘Password’, ‘required’);

if ($this->form_validation->run() == FALSE) {
// Validation failed, reload the edit form with existing data
$this->edit_user($userid);
} else {
// Prepare user data for update
$user_data = array(
‘userid’ => $this->input->post(‘userid’),
‘role’ => $this->input->post(‘role’),
‘password’ => $this->input->post(‘password’)
);

// Update user in the database
$this->User_model->update_user_by_userid($userid, $user_data);

// Redirect back to the edit page for further updates
redirect(‘UserEditController/edit_user/’ . $userid);
}
}

}

//#### User Edit View

Edit User Information

userid); ?>” method=”POST”>

    <!-- User ID (Disabled, as it shouldn't be editable) -->
    <div class="form-group">
        <label for="userid">User ID</label>
        <input type="text" class="form-control" id="userid" name="userid" value="<?php echo set_value('userid', $user->userid); ?>" readonly>
    </div>

    <!-- Role -->
    <div class="form-group">
        <label for="role">Role</label>
        <select class="form-control" id="role" name="role" required>
            <option value="">Select Role</option>
            <option value="admin" <?php echo set_select('role', 'admin', ($user->role == 'admin')); ?>>ADMIN</option>
            <option value="user" <?php echo set_select('role', 'user', ($user->role == 'user')); ?>>USER</option>
        </select>
        <?php echo form_error('role'); ?>
    </div>

    <!-- Password -->
    <div class="form-group">
        <label for="password">Password</label>
        <input type="password" class="form-control" id="password" name="password" required>
        <?php echo form_error('password'); ?>
    </div>
    
    <!-- Submit Button -->
    <div class="form-group">
        <button type="submit" class="btn btn-success">
            <i class="fas fa-save"></i> Update User
        </button>
    </div>
</form>

//#### User Edit Model

db->insert(‘users’, $data);

$data = $this->input->post();

}

public function get_user_by_userid($userid) {
$this->db->where(‘userid’, $userid);
$query = $this->db->get(‘users’); // Replace ‘users’ with your table name
return $query->row(); // Return a single row
}

// Update user details
public function update_user_by_userid($userid, $user_data) {
$this->db->where(‘userid’, $userid);
return $this->db->update(‘users’, $user_data); // Replace ‘users’ with your table name
}
}
?>

Ib have placed it in the user model

Cannot save code snippet in functions.php

So, I got this piece of code from a developer. He is now unresponsive.

When I paste this code in the functions.php file and try to save the file, I get an error :
“Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.”

Can anyone have a look and help with the code?



function wooac_added_text() {

return 'View Your Cart';

}



function wooac_check_in_cart( $product ) {

if ( ! class_exists( 'WPCleverWooac' ) || ! isset( WC()->cart ) ) {

return false;

}

if ( is_a( $product, 'WC_Product' ) ) {

$product_id = $product->get_id();

} else {

$product_id = absint( $product );

}

foreach ( WC()->cart->get_cart() as $cart_item ) {

if ( $cart_item['product_id'] == $product_id ) {

return true;

}

}



return false;

}



add_filter( 'woocommerce_product_add_to_cart_text', function ( $text, $product ) {

if ( wooac_check_in_cart( $product ) ) {

$text = wooac_added_text();

}



return $text;

}, 99, 2 );



add_filter( 'woocommerce_product_add_to_cart_url', function ( $url, $product ) {

if ( wooac_check_in_cart( $product ) ) {

$url = wc_get_cart_url();

}



return $url;

}, 99, 2 );



add_filter( 'woocommerce_product_single_add_to_cart_text', function ( $text, $product ) {

if ( wooac_check_in_cart( $product ) ) {

$text = wooac_added_text();

}



return $text;

}, 99, 2 );



add_filter( 'woocommerce_loop_add_to_cart_args', function ( $args, $product ) {

if ( wooac_check_in_cart( $product ) ) {

$args['class'] = str_replace( 'ajax_add_to_cart', '', $args['class'] );

}



return $args;

}, 99, 2 );



add_filter( 'woocommerce_add_to_cart_form_action', function ( $action ) {

global $product;



if ( wooac_check_in_cart( $product ) ) {

$action = wc_get_cart_url();

}



return $action;

}, 99 );



add_action( 'woocommerce_before_add_to_cart_button', function () {

global $product;



if ( wooac_check_in_cart( $product ) ) {

?>

<button type="submit" class="single_add_to_cart_button button alt<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>

<?php

echo '<div class="wooac-added-to-cart" style="display: none">';

}

} );



add_action( 'woocommerce_after_add_to_cart_button', function () {

global $product;



if ( wooac_check_in_cart( $product ) ) {

echo '</div><!-- /wooac-added-to-cart -->';

}

} );



add_action( 'wp_enqueue_scripts', function () {

wp_localize_script( 'wooac-frontend', 'wooac_added_vars', [

'added_text' => wooac_added_text(),

'cart_url' => wc_get_cart_url(),

] );

}, 99 );



add_action( 'wp_footer', function () {

?>

<script>

(function($) {

$(document.body).on('added_to_cart', function(e, fragments, cart_hash, $button) {

$button.text(wooac_added_vars.added_text).

removeClass('ajax_add_to_cart').

attr('href', wooac_added_vars.cart_url);

});

})(jQuery);

</script>

<?php

} );

I am no coder so what I’m looking for is someone to look at the code and tell me what I need to change to make the code work

Best approach to call external procedures (Python, Node.js, Go) from Laravel with large data transfers on the same server [closed]

I am working on a Laravel application that needs to offload some heavy computations to external services written in other programming languages (e.g., Python, Node.js, Go). The key requirements for my setup are:

Data Transfer: I need to pass potentially large datasets (several MBs or more) to these external services.

Same Machine: All scripts and services will run on the same physical/virtual machine as my Laravel application.

Performance: The solution should be efficient in terms of speed and memory usage, given the potential size of the data.

Scalability: While the services will run on a single machine for now, I’d like a solution that can scale to multiple services or machines in the future if needed.
What I’ve considered:

HTTP REST API: I could expose the external scripts via a REST API, but I’m concerned about the overhead of serializing large amounts of data in JSON format and potential performance bottlenecks.
CLI calls: Using exec() in PHP to directly run scripts, but this approach doesn’t seem robust or flexible for large data transfers or future scalability.
Queueing system: Setting up a queue (e.g., Redis, RabbitMQ) to pass data to external services. However, I’m not sure if this is the most efficient method for large data sets on the same machine.

My question:
What is the best way to organize calls to external scripts or services (Python, Node.js, Go, etc.) from a Laravel application, especially when handling large volumes of data, all running on the same server? Are there specific patterns, libraries, or communication protocols (e.g., gRPC, WebSockets, message queues) that would work best for this use case?

Any advice or examples would be greatly appreciated!

The goal:
I receive data from a third-party API and save it to the database. Then, I apply user data and generate a preliminary response in Laravel. After that, I want to pass part of the data for further processing to an external script. This script is located on the same machine. It will not duplicate or implement any server logic from Laravel or interact with third-party APIs. The goal is to obtain processed data that has already gone through server-side logic and perform post-processing on it, which will then be returned back to PHP (Laravel) to provide to the client.

add partial curved text to image with php imagick

I need to create an image with two lines of text using PHP imagick.

And the texts could be arched texts (curved) and I do not know how to do that.

I’ve managed to do it when both texts is normal or curved. But no idea if only one line of text needs to be curved / arched.

The following is my code:

<?php

$text1 = "TITLE HERE";
$text2 = "CUSTOM TEXT";

$textColor = "#ffb81c";

$text1_Pos = -40;
$text2_Pos = 40;

/* Create some objects */
$image = new Imagick();
$draw = new ImagickDraw();

$image->setResolution(300, 300);

/* New image */
$image->newImage(800, 200, new ImagickPixel('transparent'));

/* Add text color */
$draw->setFillColor($textColor);

/* Font properties */
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 57 );

/* Center text horizontally and vertically */
$draw->setGravity(Imagick::GRAVITY_CENTER);

/* Create text 1 */
$image->annotateImage($draw, 0, $text1_Pos, 0, $text1);

/* Create text 2 */
$image->annotateImage($draw, 0, $text2_Pos, 0, $text2);

/* curved text */
$distort = array(120);
$image->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);

$image->setImageMatte(true);
$image->distortImage(Imagick::DISTORTION_ARC, $distort, false);

$image->trimImage(0);
$image->setImagePage($image->getimageWidth(), $image->getimageheight(), 0, 0);

/* Give image a format */
$image->setImageFormat('png');

/* Output the image with headers */
header('Content-type: image/png');
echo $image;

Laravel/Dusk-Tests: keys() not working (e.g. ARROW_DOWN, ENTER, ..)

I’m kind of new to Laravel and Dusk-Tests and encountering issues with the LaravelDuskBrowser keys()-method. It looks like, that the sent commands are ignored by Chrome. This is the code:

$browser->visit('/index')
    ->assertSee('secret phrase')
    ->pause(300)
    ->click('#selector')
    ->pause(1000)
    ->keys('#selector', [
        WebDriverKeys::DOWN,
        WebDriverKeys::DOWN,
        WebDriverKeys::ENTER,
    ])

What I try to do is to select the second element of a -field. While click() works and opens the dropdown, the keys() simply does nothing.

I’m wondering if this maybe related to me using a Mac (macOS 14.7) or with the current Chrome or Chromedriver (129.0.6668.58)

Thanks for your help!

I’ve setup a plain Laravel 11 project with a fresh Dusk installation and a sample page. The problem remains. Also tried to Debug the communication between Dusk and the Chromedriver. I can see, that the commands should be sent, but yeah. Nothing happens when I watch how Chrome is remotely controlled by the test.

Adding custom CKEditor build produces Uncaught SyntaxError: Cannot use import statement outside a module error

I am trying to add a custom CKEditor to a ckeditor field in my setupCreateOperation() in laravel Backpack. I am following the guide in the documentation. However, I get the following error in my javascript console: Uncaught SyntaxError: Cannot use import statement outside a module.

As far as I can deduce the problem stems from the fact that the javascript code which the CKEditor Builder generates includes several import statements for the plugins:

import {
    ClassicEditor,
    AccessibilityHelp,
    Autoformat,
    AutoImage,
    AutoLink,
    Autosave,
    Base64UploadAdapter,
    Bold,
    Code,
    CodeBlock,
    Essentials,
    GeneralHtmlSupport,
    Heading,
    HtmlComment,
    HtmlEmbed,
    ImageBlock,
    ImageCaption,
    ImageInline,
    ImageInsert,
    ImageInsertViaUrl,
    ImageResize,
    ImageStyle,
    ImageTextAlternative,
    ImageToolbar,
    ImageUpload,
    Italic,
    Link,
    LinkImage,
    List,
    ListProperties,
    Markdown,
    MediaEmbed,
    Paragraph,
    SelectAll,
    ShowBlocks,
    SourceEditing,
    Table,
    TableCaption,
    TableCellProperties,
    TableColumnResize,
    TableProperties,
    TableToolbar,
    TextTransformation,
    Undo
} from 'ckeditor5';


const editorConfig = {
    toolbar: {
        items: [
            'undo',
            'redo',
            '|',
            'sourceEditing',
            'showBlocks',
            '|',
            'heading',
            '|',
            'bold',
            'italic',
            'code',
            '|',
            'link',
            'insertImage',
            'mediaEmbed',
            'insertTable',
            'codeBlock',
            'htmlEmbed',
            '|',
            'bulletedList',
            'numberedList'
        ],
        shouldNotGroupWhenFull: false
    },
    plugins: [
        AccessibilityHelp,
        Autoformat,
        AutoImage,
        AutoLink,
        Autosave,
        Base64UploadAdapter,
        Bold,
        Code,
        CodeBlock,
        Essentials,
        GeneralHtmlSupport,
        Heading,
        HtmlComment,
        HtmlEmbed,
        ImageBlock,
        ImageCaption,
        ImageInline,
        ImageInsert,
        ImageInsertViaUrl,
        ImageResize,
        ImageStyle,
        ImageTextAlternative,
        ImageToolbar,
        ImageUpload,
        Italic,
        Link,
        LinkImage,
        List,
        ListProperties,
        Markdown,
        MediaEmbed,
        Paragraph,
        SelectAll,
        ShowBlocks,
        SourceEditing,
        Table,
        TableCaption,
        TableCellProperties,
        TableColumnResize,
        TableProperties,
        TableToolbar,
        TextTransformation,
        Undo
    ],
    heading: {
        options: [
            {
                model: 'paragraph',
                title: 'Paragraph',
                class: 'ck-heading_paragraph'
            },
            {
                model: 'heading1',
                view: 'h1',
                title: 'Heading 1',
                class: 'ck-heading_heading1'
            },
            {
                model: 'heading2',
                view: 'h2',
                title: 'Heading 2',
                class: 'ck-heading_heading2'
            },
            {
                model: 'heading3',
                view: 'h3',
                title: 'Heading 3',
                class: 'ck-heading_heading3'
            },
            {
                model: 'heading4',
                view: 'h4',
                title: 'Heading 4',
                class: 'ck-heading_heading4'
            },
            {
                model: 'heading5',
                view: 'h5',
                title: 'Heading 5',
                class: 'ck-heading_heading5'
            },
            {
                model: 'heading6',
                view: 'h6',
                title: 'Heading 6',
                class: 'ck-heading_heading6'
            }
        ]
    },
    htmlSupport: {
        allow: [
            {
                name: /^.*$/,
                styles: true,
                attributes: true,
                classes: true
            }
        ]
    },
    image: {
        toolbar: [
            'toggleImageCaption',
            'imageTextAlternative',
            '|',
            'imageStyle:inline',
            'imageStyle:wrapText',
            'imageStyle:breakText',
            '|',
            'resizeImage'
        ]
    },
    initialData:
        'Test',
    link: {
        addTargetToExternalLinks: true,
        defaultProtocol: 'https://',
        decorators: {
            toggleDownloadable: {
                mode: 'manual',
                label: 'Downloadable',
                attributes: {
                    download: 'file'
                }
            }
        }
    },
    list: {
        properties: {
            styles: true,
            startIndex: true,
            reversed: true
        }
    },
    placeholder: 'Type or paste your content here!',
    table: {
        contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties']
    }
};

ClassicEditor.create(document.querySelector('#editor'), editorConfig);

When adding the file to the custom_build option for the ckeditor field, the field then calls the directive @basset(public_path('assets/js/ckeditor/ckeditor.js')) in the ckeditor field blade. The directive then smartly finds that it is a javascript file and ads the following script to the page:

<script src="http://0.0.0.0:5173/public/assets/js/ckeditor.js"></script>

However there are no type=’module’ on this script, so the error occurs.

Does anyone know if there are anyway to force a type=”module” on the script tag without manipulating with laravel backpack’s source files?

502 Bad Gateway on Nginx with Laravel, PHP 8.3, and Ubuntu 24.04

I’ve set up Nginx 1.24.0 on Ubuntu 24.04 LTS, installed PHP 8.3 (PHP 8.3.6), and deployed a fresh Laravel 11.2 project. I created a virtual host on port 82 for telegrambot.test. However, when I try to access http://telegrambot.test:82, I get a 502 Bad Gateway error.

Here’s my Nginx config (nginx.conf):

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    types_hash_max_size 2048;
    # server_tokens off;

    server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
#
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

# configuration file /etc/nginx/mime.types:

types {
    text/html                                        html htm shtml;
    text/css                                         css;
    text/xml                                         xml;
    image/gif                                        gif;
    image/jpeg                                       jpeg jpg;
    application/javascript                           js;
    application/atom+xml                             atom;
    application/rss+xml                              rss;

    text/mathml                                      mml;
    text/plain                                       txt;
    text/vnd.sun.j2me.app-descriptor                 jad;
    text/vnd.wap.wml                                 wml;
    text/x-component                                 htc;

    image/avif                                       avif;
    image/png                                        png;
    image/svg+xml                                    svg svgz;
    image/tiff                                       tif tiff;
    image/vnd.wap.wbmp                               wbmp;
    image/webp                                       webp;
    image/x-icon                                     ico;
    image/x-jng                                      jng;
    image/x-ms-bmp                                   bmp;

    font/woff                                        woff;
    font/woff2                                       woff2;

    application/java-archive                         jar war ear;
    application/json                                 json;
    application/mac-binhex40                         hqx;
    application/msword                               doc;
    application/pdf                                  pdf;
    application/postscript                           ps eps ai;
    application/rtf                                  rtf;
    application/vnd.apple.mpegurl                    m3u8;
    application/vnd.google-earth.kml+xml             kml;
    application/vnd.google-earth.kmz                 kmz;
    application/vnd.ms-excel                         xls;
    application/vnd.ms-fontobject                    eot;
    application/vnd.ms-powerpoint                    ppt;
    application/vnd.oasis.opendocument.graphics      odg;
    application/vnd.oasis.opendocument.presentation  odp;
    application/vnd.oasis.opendocument.spreadsheet   ods;
    application/vnd.oasis.opendocument.text          odt;
    application/vnd.openxmlformats-officedocument.presentationml.presentation
                                                     pptx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
                                                     xlsx;
    application/vnd.openxmlformats-officedocument.wordprocessingml.document
                                                     docx;
    application/vnd.wap.wmlc                         wmlc;
    application/wasm                                 wasm;
    application/x-7z-compressed                      7z;
    application/x-cocoa                              cco;
    application/x-java-archive-diff                  jardiff;
    application/x-java-jnlp-file                     jnlp;
    application/x-makeself                           run;
    application/x-perl                               pl pm;
    application/x-pilot                              prc pdb;
    application/x-rar-compressed                     rar;
    application/x-redhat-package-manager             rpm;
    application/x-sea                                sea;
    application/x-shockwave-flash                    swf;
    application/x-stuffit                            sit;
    application/x-tcl                                tcl tk;
    application/x-x509-ca-cert                       der pem crt;
    application/x-xpinstall                          xpi;
    application/xhtml+xml                            xhtml;
    application/xspf+xml                             xspf;
    application/zip                                  zip;

    application/octet-stream                         bin exe dll;
    application/octet-stream                         deb;
    application/octet-stream                         dmg;
    application/octet-stream                         iso img;
    application/octet-stream                         msi msp msm;

    audio/midi                                       mid midi kar;
    audio/mpeg                                       mp3;
    audio/ogg                                        ogg;
    audio/x-m4a                                      m4a;
    audio/x-realaudio                                ra;

    video/3gpp                                       3gpp 3gp;
    video/mp2t                                       ts;
    video/mp4                                        mp4;
    video/mpeg                                       mpeg mpg;
    video/ogg                                        ogv;
    video/quicktime                                  mov;
    video/webm                                       webm;
    video/x-flv                                      flv;
    video/x-m4v                                      m4v;
    video/x-matroska                                 mkv;
    video/x-mng                                      mng;
    video/x-ms-asf                                   asx asf;
    video/x-ms-wmv                                   wmv;
    video/x-msvideo                                  avi;
}

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    location ~ .php$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
    }

    # pass PHP scripts to FastCGI server
    #
    # location ~ .php$ {
    #   include snippets/fastcgi-php.conf;
    
    #   # With php-fpm (or other unix sockets):
    #   fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    #   # With php-cgi (or other tcp sockets):
    #   fastcgi_pass 127.0.0.1:9000;
    # }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /.ht {
    #   deny all;
    #}
}

# configuration file /etc/nginx/fastcgi.conf:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  REMOTE_USER        $remote_user;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# configuration file /etc/nginx/sites-enabled/telegrambot:
server {
    listen 82;
    listen [::]:82;

    server_name telegrambot.test;

    root /var/www/telegrambot/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php index.nginx-debian.html;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    charset utf-8;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ .php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /.(?!well-known).* {
        deny all;
    }
}

# configuration file /etc/nginx/fastcgi_params:

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  REMOTE_USER        $remote_user;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# configuration file /etc/nginx/sites-enabled/tutorial:
server {
       listen 81;
       listen [::]:81;

       server_name example.ubuntu.com;

       root /var/www/tutorial;
       index index.html;

       location / {
               try_files $uri $uri/ =404;
       }
}

My /etc/hosts file is configured as follows:

127.0.0.1       localhost
127.0.1.1       Amyr-Linux
127.0.0.1       telegrambot.test

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

I installed a fresh Laravel application under /var/www/telegrambot and set the public folder as the document root. I expected to be able to access the Laravel app by visiting http://telegrambot.test:82, but instead, I got a 502 Bad Gateway error.

My /var/log/nginx/error.log output:

2024/09/24 21:00:35 [error] 58482#58482: *4 open() "/home/amyr/Desktop/Sites/telbot/public/favicon.ico" failed (13: Permission denied), client: 127.0.0.1, server: telegrambot, request: "GET /favicon.ico HTTP/1.1", host: "telegrambot:82", referrer: "http://telegrambot:82/"
2024/09/24 21:00:37 [error] 58485#58485: *5 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "127.0.0.1:85"
2024/09/24 21:14:24 [error] 61674#61674: *2 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "telbot:85"
2024/09/24 21:20:52 [error] 61673#61673: *3 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "telbot:85"
2024/09/24 21:44:11 [error] 71158#71158: *2 directory index of "/var/www/telbot/public/" is forbidden, client: 127.0.0.1, server: telbot, request: "GET / HTTP/1.1", host: "telbot:85"
2024/09/24 22:26:27 [crit] 83369#83369: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:15 [crit] 84798#84798: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:19 [crit] 84799#84799: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:20 [crit] 84801#84801: *5 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:29:20 [crit] 84800#84800: *7 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:32:35 [crit] 84803#84803: *9 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:32:36 [crit] 84804#84804: *11 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 22:33:03 [crit] 84804#84804: *11 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:25:47 [crit] 84805#84805: *14 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:26:11 [crit] 90146#90146: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:27:14 [crit] 90436#90436: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test:81"
2024/09/24 23:27:40 [crit] 90623#90623: *2 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/24 23:35:20 [crit] 93355#93355: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/24 23:35:21 [crit] 93356#93356: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/24 23:35:58 [crit] 93614#93614: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:01:58 [crit] 107195#107195: *3 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:01:59 [crit] 107196#107196: *5 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:02:33 [crit] 107197#107197: *7 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:02:35 [crit] 107198#107198: *9 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:06:52 [crit] 107199#107199: *11 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:16:07 [crit] 112771#112771: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "telegrambot.test"
2024/09/25 01:17:09 [crit] 113375#113375: *2 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:17:11 [crit] 113378#113378: *4 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:48:35 [crit] 121423#121423: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:48:37 [crit] 121424#121424: *3 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 01:57:44 [crit] 121427#121427: *5 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:02:05 [crit] 2658#2658: *1 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:02:35 [crit] 2660#2660: *3 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:02:37 [crit] 2661#2661: *5 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "127.0.0.1:82"
2024/09/25 02:03:06 [crit] 2659#2659: *7 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "telegrambot.test:82"
2024/09/25 11:20:33 [crit] 2854#2854: *4 connect() to unix:/var/run/php/php7.4-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: telegrambot.test, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "telegrambot.test:82"

After reviewing my configuration, I noticed that the fastcgi_pass directive in my Nginx configuration is pointing to the PHP 7.4 FPM socket, while I am using PHP 8.3. I think this might be the root cause of the issue.

I ran the following command to check for the correct PHP 8.3 FPM socket:

sudo find /var/run/php/ -name "php8.3-fpm.sock"

Based on the result, I updated my Nginx configuration to:

fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;

However, the problem persists, and I am still getting the 502 Bad Gateway error. I also confirmed that both the Nginx and PHP-FPM services are running correctly.

I’ve tried a simple php script (phpinfo()) and it works perfect

I’m expecting Laravel to load properly when I access http://telegrambot.test:82, but instead, I keep getting this gateway error. Any suggestions on what else I should check or configure?

upi deeplink how to general this sign? [closed]

paytmmp://pa=1193735 3@cbin&pn=xxxxxx&am=500.00&tn=3T 9V&cu=INR&mc=4468&url=&mode=02&purpose=00&orgid=159002&sign=xDwsVR2KhslLdE10==

How to sign sign=xDwsVR2KhslLdE10==

If u can help me i will payment 50k to you,thanks.

paytmmp://pa=1193735 3@cbin&pn=xxxxxx&am=500.00&tn=3T 9V&cu=INR&mc=4468&url=&mode=02&purpose=00&orgid=159002&sign=xDwsVR2KhslLdE10==

How to sign sign=xDwsVR2KhslLdE10==

If u can help me i will payment 50k to you,thanks.