Laravel 8 Localisation Using mcamara package

I am trying to use multi language in my laravel 8 application frontend. I have used mcamara package, and set it up as per the guide on github.

I Have a form which accepts a input, which fetches the user. Based on the condition (if the user has taken survey, downloads a file. else shows the survey form and then redirects to download).

This is working absolutelyn fine in both languages. I am able to view the form in both languages, but once i enter the view page after id submission and i click on the language change button, i get this

SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: POST.

The issue is only in the POST method. Rest works fine.
Can someone help me on how to fix this?

Thanks in advance.

My route file

Route::redirect('/', 'en');

Route::group(['prefix' => LaravelLocalization::setLocale()], function()
{

    Route::get('/', function () {
        return redirect()->route('certificate.download');
        // return view('welcome');
    });



    // Frontend
    Route::prefix('/registration')->group(function(){
        Route::get('/add', [RegController::class, 'RegEnqAppAdd'])-> name('reg.add');
        Route::get('signature_pad', [RegController::class, 'index']);
        Route::post('signature_pad', [RegController::class, 'store'])->name('signature_pad.store');
        Route::post('/store', [RegController::class, 'RegEnqAppAddStore'])-> name('reg.store');
        });

    // Frontend Downloads
    Route::prefix('/downloads')->group(function(){
        Route::get('/certificate', [DownloadController::class, 'DownloadCertificate'])-> name('certificate.download');
        Route::get('/addcertificate/{id}', [DownloadController::class, 'AddCertificate'])-> name('certificate.add');
        Route::get('/addcertificate/group/{id}', [DownloadController::class, 'AddCertificateGroup'])-> name('groupcertificate.add');
        Route::post('/storecertificate', [DownloadController::class, 'StoreCertificate'])-> name('certificate.store');
        Route::post('/viewcertificate', [DownloadController::class, 'ViewCertificate'])-> name('certificate.view');
        Route::get('/viewcertificates/{id}', [DownloadController::class, 'ViewCertificateRedirect'])-> name('certificateredirect.view');
        Route::get('/deletecertificate/{id}/{bid}', [DownloadController::class, 'DeleteCertificateBatch'])-> name('certificate.delete');
        Route::get('/deletegroupcertificate/{id}/{gid}', [DownloadController::class, 'DeleteCertificateGroup'])-> name('groupcertificate.delete');
        });

    // Frontend Surveys
    Route::prefix('/surveys')->group(function(){
        Route::get('/post-training-questionaire/{id}',   [SurveyController::class, 'PostTrainingQuestionaire'])-> name('surveys.posttraining');
        Route::post('/post-training-questionaire/store', [SurveyController::class, 'PostTrainingQuestionaireStore'])-> name('surveys.posttrainingstore');
        });
});
// Frontend Group
// Frontend Group

My Initial View File (id input)

@extends ('frontendlayouts.frontend_master')
@section ('frontendbody')

<script src="https://code.jquery.com/jquery-3.6.0.min.js"integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="  crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>

{{-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> --}}


    <div class="content-wrapper">
        <div class="container-full">

            <div class="row">
                <div class="col-md-12">

                    <div class="content-header">
                        <div class="d-flex align-items-center">
                            <div class="mr-auto">
                                <div>
                                    <img src="{{ asset('backend/images/amilogo.png') }}" width="150px" alt="">
                                </div>

                                <h3 class="page-title" style="border-right: none;">Downloads - Certificate Download</h3>
                                    <div class="align-items-center">
                                        <nav>
                                            <ol class="breadcrumb">
                                                <li class="breadcrumb-item"><a href="#"><i class="mdi mdi-home-outline"></i></a></li>
                                                <li class="breadcrumb-item active" aria-current="page">{{ __('Course Certificate') }}</li>
                                            </ol>
                                        </nav>
                                    </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

            <section class="content">
                <div class="box">
                    <div class="box-header with-border">
                        <h4 class="box-title">{{ __('Enter Your CPR Number to Download Your Certificates') }}</h4>
                    </div>
                    <form class="form" method="post" action="{{ route('certificate.view') }}" enctype="multipart/form-data" id="posttrainingquestionaire">
                        @csrf
                        <div class="box-body">

                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>{{ __('CPR Number') }}</label>
                                        <input type="text" name="cprnumber" id="cprnumber" class="form-control" maxlength="9" placeholder="CPR Number" required data-validation-required-message="This field is required">
                                    </div>
                                        @error('cprnumber')
                                        <span class="text-info">{{ $message }}</span>
                                        @enderror
                                </div>
                            </div>

                        </div>
                        <div class="box-footer">
                            <button onclick="$('#posttrainingquestionaire').submit()" class="btn btn-rounded btn-primary btn-outline">
                                <i class="ti-save-alt"></i> {{ __('Submit & Download') }}
                            </button>
                        </div>
                    </form>
                </div>
            </section>

        </div>
    </div>

@endsection

My view_certificate view

@extends ('frontendlayouts.frontend_master')
@section ('frontendbody')

<script src="https://code.jquery.com/jquery-3.6.0.min.js"integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="  crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>


    <div class="content-wrapper">
        <div class="container-full">

            <div class="content-header">
                <div class="d-flex align-items-center">
                    <div class="mr-auto">
                        <div>
                            <img src="{{ asset('backend/images/amilogo.png') }}" width="150px" alt="">
                        </div>

                        <h3 class="page-title" style="border-right: none;">Downloads - Certificate Download</h3>
                            <div class="align-items-center">
                                <nav>
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item"><a href="#"><i class="mdi mdi-home-outline"></i></a></li>
                                        <li class="breadcrumb-item active" aria-current="page">{{ __('Course Certificate') }}</li>
                                    </ol>
                                </nav>
                            </div>
                    </div>
                </div>
            </div>

            <section class="content">
                <div class="box">
                    <div class="box-header with-border">
                        {{-- <h4 class="box-title">Enter Your CPR Number to Download Your Certificates</h4> --}}
                        <h1>{{ __('Welcome to Almoalem Institute') }}</h1>

                    </div>
                    <form class="form" method="post" action="{{ route('certificate.view' ) }}" enctype="multipart/form-data" id="posttrainingquestionaire">
                        @csrf
                        <div class="box-body">

                            <div class="row">
                                <div class="col-md-12">

                                    <div class="timeline-event">
                                        <div class="timeline-body">

                                            <div class="media-body">
                                                <div class="timeline-title"><strong>{{ __('CPR Number') }}:</strong></span> <span class="timeline-body">{{ $learnerData->cprnumber }}</span>
                                                    <br>
                                                <span class="timeline-title"><strong>{{ __('Full Name') }}:</strong></span> <span class="timeline-body">{{ $learnerData->fullname }}</span></div>
                                                <br>
                                                <br>

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

                                    <div class="col-12">
                                        <div class="box">
                                            <div class="box-body no-padding">
                                                <div class="table-responsive">
                                                    <table class="table table-hover">
                                                        <tr>
                                                            <th>Sl. No</th>
                                                            <th>Course</th>
                                                            <th>Download Certificate</th>
                                                        </tr>
                                                        <?php $app =array(); ?>
                                                        @foreach($downloadData as $key => $dd)
                                                        <tr>
                                                            <td>{{ $key+1 }}</td>
                                                            <td>{{ $dd->applicationmanagement->courseapplied }}</td>
                                                            <td>
                                                                @if($dd->surveytaken!=NULL || in_array($dd->courseapplication_id, $app))
                                                                <?php $app[$key]=$dd->courseapplication_id;?>
                                                                <p class="text-black">
                                                                    <a  href="{{asset('certificate/'.$dd->certificate) }}" class="btn btn-primary md-5" target="_blank">{{ __('Download Certificate') }}</a>
                                                                </p>
                                                                @else
                                                                <a href="{{route('surveys.posttraining',$dd->id)}}" class="btn btn-dark md-5"> {{ __('Complete Training Feedback to Download Certificate') }}</a>

                                                                @endif
                                                            </td>
                                                        </tr>
                                                        @endforeach
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>


                                </div>
                            </div>

                        </div>
                    </form>
                </div>
            </section>

        </div>
    </div>

@endsection

laravel RSA decryption very slow

We are storing some consumer data in database. The sensitive data is stored in encryption format and we are encrypting the data using RSA encryption. We are using phpseclib for encryption in the laravel. We are using setters to encrypt the data at the time of storing to database.

    $rsa = new RSA();
    $publicfilecontent = Storage::disk('local')->get('publickey.txt');
    $rsa->loadKey($publicfilecontent); 
    $this->attributes['address'] = $rsa->encrypt($address);

This works fine and the data is stored in blob type in the database. The issue is that when we are retrieving the data from the database, the data for many consumers is returned at the same time. We are decrypting the addresses of these employees. Since MySQL does not offer decryption, we have to decrypt the address at the laraval level and it has to be done for each employee. See the example below.

$serviceproviders = Providers::where('city_id',$request->city_id)->get();

foreach ($serviceproviders as $key => $serviceprovider) {
  $rsa = new RSA();
  $privatefilecontent = Storage::disk('local')->get('privatekey.txt');
  $rsa->loadKey($privatefilecontent); 
  $address_decrypted= $rsa->decrypt($serviceprovider->address);
  $serprov_array[$key] = $serviceprovider;
  $serprov_array[$key]->distance_decrypted= $address_decrypted;
}

The above code works fine but the problem is that it is too slow. Only for 20 records, it took 5 sec to return the data in the mobile app while without the decryption, the data returns in 500 ms. We have to load hundreds of service providers so this performance is not at acceptable level at the moment.

Can someone please guide how to improve the performance of the decryption process?

How I can get total sum of daily values of a column in Laravel?

There is an orders table with a total column that has more than 1000 records. How I can get the daily sum of total for each day. I mean for Monday, Thursday, Wednesday, …. there are many and different rows, and I want to show the sum of total of each day separately? in UI as:

saturday: 111211,
sunday: 211444,
Monday: 120012000,
Thursday: 1225121,

How to save data on database from a dynamic table

How to save data on database from a dynamic table. I am able to display the invoices on the table, I would like to save individual rows only but instead, the table saves only the first reference(invoice) and the last amount

        <thead>
            <tr>
                <th class="text-md-left"><?php echo lang("nьз╕"); ?></th>
                <th class="text-md-left"><?php echo lang("date"); ?></th>
                <th class="text-md-left"><?php echo lang("invoice"); ?></th>
                <th class="text-md-right"><?php echo lang("amount"); ?></th>
                <th class="text-md-right"><?php echo lang("amount_due"); ?></th>
                <th class="text-md-right"><?php echo lang("payments_create"); ?></th>
            </tr>
        </thead>
        <tbody>
            <?php
            $amount = 0; $k = 1; $sp = strlen(count($invoices)."");
            foreach ($invoices as $row) {
                if(is_object($row)){$row = objectToArray($row);} ?>
                <tr>
                    
                    <td class="text-md-left"><?php echo str_pad($k, $sp, "0", STR_PAD_LEFT) ?></td>
                    <td class="text-md-left"><?php echo date_MYSQL_PHP($row["date"]) ?><small><small><br>Date Due <?php echo $row['date']; ?></small></small></td>
                    <td class="text-md-left"><?php echo form_input ($invoice_input); echo $row["reference"],
       form_hidden('receipt[invoice_id]', set_value('receipt[invoice_id]', $invoice_id)),
       form_hidden('payment[invoice_id]', set_value('payment[invoice_id]', $invoice_id));
      ?></td>
                    <td class="text-md-right"><?php echo formatMoney($row["total"], $currency); ?></td>
                    <td class="text-md-right"><?php echo formatMoney($row["total_due"], $currency); ?></td>
                    <td class="text-md-right"> 
        <input type="number" step="any" min="0" value="<?php foreach($row['payment'] as $payment)
    echo set_value("payment[amount]<br>", $invoice->total_due);  echo str_pad($k, "total_due") ?>" name="payment[amount]" class="form-control" />
     
     </td>
        
      
    </div></tr>
            <?php
                $k++;
                $amount += $row["amount"];
            } // end foreach
            ?> ```

headers already sent in php

The thing is on my local server its working just fine. Its only when it is uploaded
that it becomes an issue.This is the error i am getting&*/
Warning: Cannot modify header information – headers already sent by (output started
at /home/primepai/public_html/admin/userValidate.php:6) in
/home/primepai/public_html/admin/userValidate.php on line 38

<?php ob_start();?>
<?php session_start();?>
<?php 
//include config.php to connect to the database
include("../config.php");?>
<?php
if(isset($_POST['login'])){
$username= $_POST['username'];
$password= $_POST['password'];

$username = mysqli_real_escape_string($mysqli, $username);
$password = mysqli_real_escape_string($mysqli, $password); 
    
$query = "SELECT * FROM users WHERE username = '$username'";
$select_query = mysqli_query($mysqli, $query);

if(!$select_query){
    die("QUERY FAILED". mysqli_error($mysqli));
}
    
while($row = mysqli_fetch_array($select_query)){
$db_fullname = $row['full_name'];
$db_username = $row['username']; 
$db_password = $row['password'];
$db_userid = $row['user_id']; 
$db_userimage = $row['picture'];
}    
if ($username === $db_username && $password === $db_password){
$_SESSION['username'] = $db_username;
$_SESSION['full_name'] = $db_fullname;
$_SESSION['password'] = $db_password;
$_SESSION['user_id'] = $db_userid;
$_SESSION['picture'] = $db_userimage;
header("Location: dashboard.php");
die();
exit();
} else {
header("Location: index.php");
}  
}?>

HTML / Javascript einblenden der Virtuellen Touch Tastatur von Windows [closed]

Ich habe folgendes Problem.
Ich habe einen Touch Monitor an dem keine Tastatur angeschlossen ist.
Auf dem Monitor wird eine E-Mail Registrierung per HTML Seite angezeigt.

Mein Problem, die Windows Touch Tastatur wird nur automatisch eingeblendet wenn ich auf
ein Passwort Feld (und da nur beim Border) klicke. Bei E-Mail oder normalen Text Feldern wird die Tastatur nicht eingeblendet.

Hat hier wer eine Idee wie man das mit Javacript oder sonstiges erzwingen kann?

Set Focus auf das Password Feld funktioniert leider nicht.

LG
Martin

How to get data from one server and store in another server in PHP

I need to get mysql data from one server(host1) and store in to another server(host2).

Here is my try.

<?php
$servername = "host1";
$username = "root";
$password = "";
$dbname = "userdetails";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}

//$sql = "SELECT ts, a, logic,status,rel,MAX(ts) OVER (PARTITION BY a) AS LastUpdated FROM block_queue_alltime order by ts";
$sql = "SELECT a,logic from usertable";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
  // output data of each row
  $a=array();
  $logic=array();
  while($row = $result->fetch_assoc()) {
    $a[]=$row["a"];
    $logic[]=$row["logic"];
  }
  
} else {
  echo "0 results";
}

$servername2 = "host2";
$username2 = "root";
$password2 = "";
$dbname2 = "userdetails2";

$conn2 = mysqli_connect($servername2, $username2, $password2, $dbname2);

 if (!$conn2) {
  die("Connection failed: " . mysqli_connect_error());
} 
 
$sql2 = "INSERT INTO testdata (number, logic) VALUES ('$a', '$logic')";
 
$result2 = mysqli_query($conn2, $sql2);

if ($result2 === TRUE) {
    echo "New record created successfully";
  } else {
    echo "Error: " . $sql . "<br>" . $conn->error;
  }


mysqli_close($conn);
?>

I can see when print_r($a) and print_r($logic) provides the required array of numbers what I need. But when it inserting to another the table. It shows only zeros in the databases and New record created successfully also prints. Can someone show me an efficient way to store all the data from one host to another?

Change Woocommerce quantity / productname order in checkout table

I would like to change the order of items in the checkout order area.
I want to show the product quantity before the product name.

So instead of:
Air flow meter oxygen × 1

I would like to show:
1 x Air flow meter oxygen

I’ve managed to find the review-order.php and added it to my child theme so it’s update compatible.

I changed the order like this:

                    <?php echo apply_filters( 'woocommerce_checkout_cart_item_quantity', ' <strong class="product-quantity">' . sprintf( $cart_item['quantity'], '&times;&nbsp;%s' ) . '</strong>', $cart_item, $cart_item_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
                    <?php echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) ) . '&nbsp;'; ?>

                    <?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

It now shows:

x 1
Air flow meter oxygen

I can’t seem to figure out how:

  • I can remove the break after the quantity so it is set on one line.

  • And how to change the order of the number and the x
    I already switched the $cart_item[‘quantity’] and the ‘× %s’. But I guess that does nothing.

Hope somebody can help, I really appreciate it.
Kind regards,
Emile

Pivot tables with laravel

im new in laravel and php and im working on a project that has a specific requirements. I would appreciate if you would help me get into right direction. Use case is:

I need a project for my client that’s gonna track balances between
warehouses, generating documents and updating balances and transfers
between ones. Every item in warehouse should have its own LOT code (ex
2 items that received in warehouse can have different codes and i need
to update balance for that particular LOT code but still be able to
show balance sum for that item with all LOT codes). Users with right
permission should have access to only 1 warehouse (and admin should
have access for all), and be able to transfer items to another by
which LOT code would be generated. So lets give an example:

User 1 has access to warehouse Storage and Finished products; User 2
has access to warehouse Preparation;

Balance of Storage for item sugar is 1000kg with LOT code “28012022”;
User 1 receives 500kg of ex sugar with LOT code “02022022” (or
autogenerated if no input), he enters all the data about that
reception in fields. He then sends 200kg with LOT code 28012022 and
100kg with “02022022” to Preparation warehouse. User 2 confirms
transaction and Storage balance is updated with new values subtracted
with that amounts, and Preparation warehouse is updated with new item
values and new LOT code is generated (28012022/02022022)

User 2 then enters spent amounts and how much of Finished products is
made from it, his balance is updated with balance left and LOT code
(in this example 28012022/02022022). Then user 2 commits transaction
and user 1 confirms it and Finished Products balance is updated with
new generated LOT code (28012022/02022022/currentDate);

My question is, should i use pivot tables in laravel, and as im using spatie laravel permission, how should i implement that so that i can give access to some users only for certain warehouses?
Any pointers in right direction will be appreciated.
Here is git of a project:
https://github.com/cile1993/cmss

Include edit-tags.php in submenu page WordPress

I am making a plugin for WordPress (5.9).
I would like to include the page edit-tags.php to create and edit the tags which are specifics to a custom post type.
In my submenu page, I simply put that : include_once(plugin_dir_path(__DIR__)."includes/php/editTags.php");

My editTags.php :

<?php
/**
 * To include in BTH options
 * Edit Tags Administration Screen.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */

$taxnow = "adLabels";
$taxonomy = "adLabels";
$current_screen = get_current_screen();


if ( ! $taxnow ) {
    wp_die( __( 'Invalid taxonomy.' ) );
}

$tax = get_taxonomy( $taxnow );

if ( ! $tax ) {
    wp_die( __( 'Invalid taxonomy.' ) );
}

if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ), true ) ) {
    wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) );
}

if ( ! current_user_can( $tax->cap->manage_terms ) ) {
    wp_die(
        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
        '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
        403
    );
}

/**
 * $post_type is set when the WP_Terms_List_Table instance is created
 *
 * @global string $post_type
 */
global $post_type;

$wp_list_table = _get_list_table( 'WP_Terms_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

$title = $tax->labels->name;

if ( 'post' !== $post_type ) {
    $parent_file  = ( 'attachment' === $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type";
    $submenu_file = "edit-tags.php?taxonomy=$taxonomy&amp;post_type=$post_type";
} elseif ( 'link_category' === $tax->name ) {
    $parent_file  = 'link-manager.php';
    $submenu_file = 'edit-tags.php?taxonomy=link_category';
} else {
    $parent_file  = 'edit.php';
    $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
}

add_screen_option(
    'per_page',
    array(
        'default' => 20,
        'option'  => 'edit_' . $tax->name . '_per_page',
    )
);

get_current_screen()->set_screen_reader_content(
    array(
        'heading_pagination' => $tax->labels->items_list_navigation,
        'heading_list'       => $tax->labels->items_list,
    )
);

$location = false;
$referer  = wp_get_referer();
if ( ! $referer ) { // For POST requests.
    $referer = wp_unslash( $_SERVER['REQUEST_URI'] );
}
$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer );
switch ( $wp_list_table->current_action() ) {

    case 'add-tag':
        check_admin_referer( 'add-tag', '_wpnonce_add-tag' );

        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
                403
            );
        }

        $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
        if ( $ret && ! is_wp_error( $ret ) ) {
            $location = add_query_arg( 'message', 1, $referer );
        } else {
            $location = add_query_arg(
                array(
                    'error'   => true,
                    'message' => 4,
                ),
                $referer
            );
        }

        break;

    case 'delete':
        if ( ! isset( $_REQUEST['tag_ID'] ) ) {
            break;
        }

        $tag_ID = (int) $_REQUEST['tag_ID'];
        check_admin_referer( 'delete-tag_' . $tag_ID );

        if ( ! current_user_can( 'delete_term', $tag_ID ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
                403
            );
        }

        wp_delete_term( $tag_ID, $taxonomy );

        $location = add_query_arg( 'message', 2, $referer );

        // When deleting a term, prevent the action from redirecting back to a term that no longer exists.
        $location = remove_query_arg( array( 'tag_ID', 'action' ), $location );

        break;

    case 'bulk-delete':
        check_admin_referer( 'bulk-tags' );

        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
                403
            );
        }

        $tags = (array) $_REQUEST['delete_tags'];
        foreach ( $tags as $tag_ID ) {
            wp_delete_term( $tag_ID, $taxonomy );
        }

        $location = add_query_arg( 'message', 6, $referer );

        break;

    case 'edit':
        if ( ! isset( $_REQUEST['tag_ID'] ) ) {
            break;
        }

        $term_id = (int) $_REQUEST['tag_ID'];
        $term    = get_term( $term_id );

        if ( ! $term instanceof WP_Term ) {
            wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
        }

        wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) );
        exit;

    case 'editedtag':
        $tag_ID = (int) $_POST['tag_ID'];
        check_admin_referer( 'update-tag_' . $tag_ID );

        if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
                403
            );
        }

        $tag = get_term( $tag_ID, $taxonomy );
        if ( ! $tag ) {
            wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
        }

        $ret = wp_update_term( $tag_ID, $taxonomy, $_POST );

        if ( $ret && ! is_wp_error( $ret ) ) {
            $location = add_query_arg( 'message', 3, $referer );
        } else {
            $location = add_query_arg(
                array(
                    'error'   => true,
                    'message' => 5,
                ),
                $referer
            );
        }
        break;
    default:
        if ( ! $wp_list_table->current_action() || ! isset( $_REQUEST['delete_tags'] ) ) {
            break;
        }
        check_admin_referer( 'bulk-tags' );

        $screen = get_current_screen()->id;
        $tags   = (array) $_REQUEST['delete_tags'];

        /** This action is documented in wp-admin/edit.php */
        $location = apply_filters( "handle_bulk_actions-{$screen}", $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
        break;
}

if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
    $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) );
}

if ( $location ) {
    if ( $pagenum > 1 ) {
        $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages.
    }

    /**
     * Filters the taxonomy redirect destination URL.
     *
     * @since 4.6.0
     *
     * @param string      $location The destination URL.
     * @param WP_Taxonomy $tax      The taxonomy object.
     */
    wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );
    exit;
}

$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );

if ( $pagenum > $total_pages && $total_pages > 0 ) {
    wp_redirect( add_query_arg( 'paged', $total_pages ) );
    exit;
}

wp_enqueue_script( 'admin-tags' );
if ( current_user_can( $tax->cap->edit_terms ) ) {
    wp_enqueue_script( 'inline-edit-tax' );
}

if ( 'category' === $taxonomy || 'link_category' === $taxonomy || 'post_tag' === $taxonomy ) {
    $help = '';
    if ( 'category' === $taxonomy ) {
        $help = '<p>' . sprintf(
            /* translators: %s: URL to Writing Settings screen. */
            __( 'You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.' ),
            'options-writing.php'
        ) . '</p>';
    } elseif ( 'link_category' === $taxonomy ) {
        $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>';
    } else {
        $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there&#8217;s no relationship from one tag to another.' ) . '</p>';
    }

    if ( 'link_category' === $taxonomy ) {
        $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>';
    } else {
        $help .= '<p>' . __( 'What&#8217;s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>';
    }

    get_current_screen()->add_help_tab(
        array(
            'id'      => 'overview',
            'title'   => __( 'Overview' ),
            'content' => $help,
        )
    );

    if ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) {
        if ( 'category' === $taxonomy ) {
            $help = '<p>' . __( 'When adding a new category on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
        } else {
            $help = '<p>' . __( 'When adding a new tag on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
        }

        $help .= '<ul>' .
        '<li>' . __( '<strong>Name</strong> &mdash; The name is how it appears on your site.' ) . '</li>';

        if ( ! global_terms_enabled() ) {
            $help .= '<li>' . __( '<strong>Slug</strong> &mdash; The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>';
        }

        if ( 'category' === $taxonomy ) {
            $help .= '<li>' . __( '<strong>Parent</strong> &mdash; Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>';
        }

        $help .= '<li>' . __( '<strong>Description</strong> &mdash; The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
        '</ul>' .
        '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>';

        get_current_screen()->add_help_tab(
            array(
                'id'      => 'adding-terms',
                'title'   => 'category' === $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ),
                'content' => $help,
            )
        );
    }

    $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';

    if ( 'category' === $taxonomy ) {
        $help .= '<p>' . __( '<a href="https://wordpress.org/support/article/posts-categories-screen/">Documentation on Categories</a>' ) . '</p>';
    } elseif ( 'link_category' === $taxonomy ) {
        $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>' ) . '</p>';
    } else {
        $help .= '<p>' . __( '<a href="https://wordpress.org/support/article/posts-tags-screen/">Documentation on Tags</a>' ) . '</p>';
    }

    $help .= '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>';

    get_current_screen()->set_help_sidebar( $help );

    unset( $help );
}

//require_once ABSPATH . 'wp-admin/admin-header.php';

// Also used by the Edit Tag form.
require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php';

$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';

if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
    $import_link = admin_url( 'admin.php?import=wpcat2tag' );
} else {
    $import_link = admin_url( 'import.php' );
}

?>

<div class="wrap nosubsub">
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>

<?php
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
    echo '<span class="subtitle">';
    printf(
        /* translators: %s: Search query. */
        __( 'Search results for: %s' ),
        '<strong>' . esc_html( wp_unslash( $_REQUEST['s'] ) ) . '</strong>'
    );
    echo '</span>';
}
?>

<hr class="wp-header-end">

<?php if ( $message ) : ?>
<div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div>
    <?php
    $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );
endif;
?>
<div id="ajax-response"></div>

<form class="search-form wp-clearfix" method="get">
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />

<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>

</form>

<?php
$can_edit_terms = current_user_can( $tax->cap->edit_terms );

if ( $can_edit_terms ) {
    ?>
<div id="col-container" class="wp-clearfix">

<div id="col-left">
<div class="col-wrap">

    <?php
    if ( 'category' === $taxonomy ) {
        /**
         * Fires before the Add Category form.
         *
         * @since 2.1.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'add_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
    } elseif ( 'link_category' === $taxonomy ) {
        /**
         * Fires before the link category form.
         *
         * @since 2.3.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'add_link_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
    } else {
        /**
         * Fires before the Add Tag form.
         *
         * @since 2.5.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
         *
         * @param string $taxonomy The taxonomy slug.
         */
        do_action_deprecated( 'add_tag_form_pre', array( $taxonomy ), '3.0.0', '{$taxonomy}_pre_add_form' );
    }

    /**
     * Fires before the Add Term form for all taxonomies.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_pre_add_form`
     *  - `post_tag_pre_add_form`
     *
     * @since 3.0.0
     *
     * @param string $taxonomy The taxonomy slug.
     */
    do_action( "{$taxonomy}_pre_add_form", $taxonomy );
    ?>

<div class="form-wrap">
<h2><?php echo $tax->labels->add_new_item; ?></h2>
<form id="addtag" method="post" action="edit-tags.php" class="validate"
    <?php
    /**
     * Fires inside the Add Tag form tag.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_term_new_form_tag`
     *  - `post_tag_term_new_form_tag`
     *
     * @since 3.7.0
     */
    do_action( "{$taxonomy}_term_new_form_tag" );
    ?>
>
<input type="hidden" name="action" value="add-tag" />
<input type="hidden" name="screen" value="<?php echo esc_attr( $current_screen->id ); ?>" />
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
    <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?>

<div class="form-field form-required term-name-wrap">
    <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
    <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    <p><?php echo $tax->labels->name_field_description; ?></p>
</div>
    <?php if ( ! global_terms_enabled() ) : ?>
<div class="form-field term-slug-wrap">
    <label for="tag-slug"><?php _e( 'Slug' ); ?></label>
    <input name="slug" id="tag-slug" type="text" value="" size="40" />
    <p><?php echo $tax->labels->slug_field_description; ?></p>
</div>
<?php endif; // global_terms_enabled() ?>
    <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
<div class="form-field term-parent-wrap">
    <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label>
        <?php
        $dropdown_args = array(
            'hide_empty'       => 0,
            'hide_if_empty'    => false,
            'taxonomy'         => $taxonomy,
            'name'             => 'parent',
            'orderby'          => 'name',
            'hierarchical'     => true,
            'show_option_none' => __( 'None' ),
        );

        /**
         * Filters the taxonomy parent drop-down on the Edit Term page.
         *
         * @since 3.7.0
         * @since 4.2.0 Added `$context` parameter.
         *
         * @param array  $dropdown_args {
         *     An array of taxonomy parent drop-down arguments.
         *
         *     @type int|bool $hide_empty       Whether to hide terms not attached to any posts. Default 0|false.
         *     @type bool     $hide_if_empty    Whether to hide the drop-down if no terms exist. Default false.
         *     @type string   $taxonomy         The taxonomy slug.
         *     @type string   $name             Value of the name attribute to use for the drop-down select element.
         *                                      Default 'parent'.
         *     @type string   $orderby          The field to order by. Default 'name'.
         *     @type bool     $hierarchical     Whether the taxonomy is hierarchical. Default true.
         *     @type string   $show_option_none Label to display if there are no terms. Default 'None'.
         * }
         * @param string $taxonomy The taxonomy slug.
         * @param string $context  Filter context. Accepts 'new' or 'edit'.
         */
        $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );

        wp_dropdown_categories( $dropdown_args );
        ?>
        <?php if ( 'category' === $taxonomy ) : ?>
        <p><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p>
    <?php else : ?>
        <p><?php echo $tax->labels->parent_field_description; ?></p>
    <?php endif; ?>
</div>
    <?php endif; // is_taxonomy_hierarchical() ?>
<div class="form-field term-description-wrap">
    <label for="tag-description"><?php _e( 'Description' ); ?></label>
    <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
    <p><?php echo $tax->labels->desc_field_description; ?></p>
</div>

    <?php
    if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
        /**
         * Fires after the Add Tag form fields for non-hierarchical taxonomies.
         *
         * @since 3.0.0
         *
         * @param string $taxonomy The taxonomy slug.
         */
        do_action( 'add_tag_form_fields', $taxonomy );
    }

    /**
     * Fires after the Add Term form fields.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_add_form_fields`
     *  - `post_tag_add_form_fields`
     *
     * @since 3.0.0
     *
     * @param string $taxonomy The taxonomy slug.
     */
    do_action( "{$taxonomy}_add_form_fields", $taxonomy );
    ?>
    <p class="submit">
        <?php submit_button( $tax->labels->add_new_item, 'primary', 'submit', false ); ?>
        <span class="spinner"></span>
    </p>
    <?php
    if ( 'category' === $taxonomy ) {
        /**
         * Fires at the end of the Edit Category form.
         *
         * @since 2.1.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'edit_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
    } elseif ( 'link_category' === $taxonomy ) {
        /**
         * Fires at the end of the Edit Link form.
         *
         * @since 2.3.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'edit_link_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
    } else {
        /**
         * Fires at the end of the Add Tag form.
         *
         * @since 2.7.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
         *
         * @param string $taxonomy The taxonomy slug.
         */
        do_action_deprecated( 'add_tag_form', array( $taxonomy ), '3.0.0', '{$taxonomy}_add_form' );
    }

    /**
     * Fires at the end of the Add Term form for all taxonomies.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_add_form`
     *  - `post_tag_add_form`
     *
     * @since 3.0.0
     *
     * @param string $taxonomy The taxonomy slug.
     */
    do_action( "{$taxonomy}_add_form", $taxonomy );
    ?>
</form></div>
</div>
</div><!-- /col-left -->

<div id="col-right">
<div class="col-wrap">
<?php } ?>

<?php $wp_list_table->views(); ?>

<form id="posts-filter" method="post">
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />

<?php $wp_list_table->display(); ?>

</form>

<?php if ( 'category' === $taxonomy ) : ?>
<div class="form-wrap edit-term-notes">
<p>
    <?php
    printf(
        /* translators: %s: Default category. */
        __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the default category %s. The default category cannot be deleted.' ),
        /** This filter is documented in wp-includes/category-template.php */
        '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>'
    );
    ?>
</p>
    <?php if ( current_user_can( 'import' ) ) : ?>
    <p>
        <?php
        printf(
            /* translators: %s: URL to Categories to Tags Converter tool. */
            __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ),
            esc_url( $import_link )
        );
        ?>
    </p>
    <?php endif; ?>
</div>
<?php elseif ( 'post_tag' === $taxonomy && current_user_can( 'import' ) ) : ?>
<div class="form-wrap edit-term-notes">
<p>
    <?php
    printf(
        /* translators: %s: URL to Categories to Tags Converter tool. */
        __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ),
        esc_url( $import_link )
    );
    ?>
    </p>
</div>
    <?php
endif;

/**
 * Fires after the taxonomy list table.
 *
 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 *
 * Possible hook names include:
 *
 *  - `after-category-table`
 *  - `after-post_tag-table`
 *
 * @since 3.0.0
 *
 * @param string $taxonomy The taxonomy name.
 */
do_action( "after-{$taxonomy}-table", $taxonomy );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

if ( $can_edit_terms ) {
    ?>
</div>
</div><!-- /col-right -->

</div><!-- /col-container -->
<?php } ?>

</div><!-- /wrap -->

<?php if ( ! wp_is_mobile() ) : ?>
<script type="text/javascript">
try{document.forms.addtag['tag-name'].focus();}catch(e){}
</script>
    <?php
endif;

$wp_list_table->inline_edit();

?>

Of course, I can just include the original edit-tags.php if the file doesn’t need any modification. For now, I just added $taxnox, $taxonomy and $current_screen as you can see after the comments at the beginning of the code. In the URL of the submenu page, I also added “taxonomy=adLabels“.

My problem is, the list of tags is not showing as you can see here.
I have no PHP error (I am in WP_DEBUG mode) and no error in the web console.

What am I missing ?

Thank you for your help.

PHP Posting variables to another page after calculation

i’m trying to post my variables “$correct” and “$incorrect” over to another page call “testresult.php”. But i can’t seem to receive the variables on the other page. Is there something wrong with my codes?

<form action="testresult.php" method="POST">
    <label for="qn1">Question 1: <?php echo $array_question[$question_num_array[0]] ?></label><br>
    <input type="text" id="question1_answer" name="question1_answer" required><br><br>
    
    <label for="qn2">Question 2: <?php echo $array_question[$question_num_array[1]] ?></label><br>
    <input type="text" id="question2_answer" name="question2_answer" required><br><br>

    <label for="qn3">Question 3: <?php echo $array_question[$question_num_array[2]] ?></label><br>
    <input type="text" id="question3_answer" name="question3_answer" required><br><br>

    <input type="hidden" name="correct" id="correct" value="<?php $correct ?>" />
    <input type="hidden" name="incorrect" id="incorrect" value="<?php $incorrect ?>" />
    
    <input type="submit" name="submitAnswers" value="Submit">
</form>

<?php
        if(isset($_POST["submitAnswers"])){
            $correct = 0;
            $incorrect = 0;
            $qn1_ans = $_POST['question1_answer'];
            $qn2_ans = $_POST['question2_answer'];
            $qn3_ans = $_POST['question3_answer'];

            if ($qn1_ans == $array_answer[$question_num_array[0]]){ $correct ++; }
            else { $incorrect ++; }

            if ($qn2_ans == $array_answer[$question_num_array[1]]){ $correct ++; }
            else { $incorrect ++; }

            if ($qn3_ans == $array_answer[$question_num_array[2]]){ $correct ++; }
            else { $incorrect ++; }

        }
    ?>

On the other page, this is my code.

<html>
    <head>
    <title>Results</title>
    </head>
    <body>
        <?php
        $correct = $_POST['correct'];
        $incorrect = $_POST['incorrect'];

        echo $correct."test ".$incorrect;
        ?>
    </body>
</html>

Problem in docker images it is not starting

I made in my project nginx, mysql, phpMyadmin, encore and php images.
Just php and encore dosent work, they are successed built, but the are with red color.

that is my docker-compose.yml:

version: '3.3'
services:
 database:
   container_name: database
   image: mysql:8.0
   restart: always
   command: --default-authentication-plugin=mysql_native_password
   environment:
     MYSQL_ROOT_PASSWORD: alsbls
     MYSQL_DATABASE: infoSystem
     MYSQL_USER: alsbls
     MYSQL_PASSWORD: alsbls
   ports:
     - '4306:3306'
   volumes:
     - ./mysql:/var/lib/mysql

 php:
   container_name: php
   restart: always
   build:
     context: ./php
   ports:
     - '9000:9000'
   volumes:
     - ./app:/var/www/infoSystem

   depends_on:
     - database

 nginx:
   container_name: nginx
   image: nginx:stable-alpine
   restart: always
   ports:
     - '8080:80'
   volumes:
     - ./app:/var/www/infoSystem
     - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
   depends_on:
     - php
     - database

 phpmyadmin:
   image: phpmyadmin/phpmyadmin:latest
   restart: always
   environment:
     PMA_HOST: database
     PMA_USER: alsbls_root
     PMA_PASSWORD: alsbls_root
   ports:
     - "8081:81"

 encore:
   container_name: encore
   restart: always
   build:
     context: ./php
   volumes:
       - ./:/var/www/html

That is my Dockerfile:

FROM php:8.0-fpm
          
RUN apt update   
            && apt install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip 
            && docker-php-ext-install intl opcache pdo pdo_mysql 
            && pecl install apcu 
            && docker-php-ext-enable apcu 
            && docker-php-ext-configure zip 
            && docker-php-ext-install zip
WORKDIR /var/www/infoSystem
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony
RUN git config --global user.email "[email protected]" 
        && git config --global user.name  "alsbls"




FROM node:12.10.0
WORKDIR /var/www/html
COPY entrypoint.sh /usr/local/bin/entrypoint
RUN ["chmod", "+x", "/usr/local/bin/entrypoint"]
ENTRYPOINT ["/usr/local/bin/entrypoint"]
USER node

that is the entrypoint.sh in the same dir of Dockerfile:

#!/bin/bash
# Prevent container from shutting down
while true; do sleep 3600; done

I didn’t receive any error message on the terminal.
Maybe some one now the issues.

Best regards

“CREATE TABLE IF NOT EXISTS” does not return error if exists [closed]

This is my code:

$query = "CREATE TABLE IF NOT EXISTS `data`(`id` INT(11) AUTO_INCREMENT, `car` INT(11), PRIMARY KEY(id))";

try {
    $stm = self::$connection->query($query);
    echo 'done';
} catch (PDOException $e) {
    echo $e->getMessage();
}

This code work fine, but if table is exists, PDO not return any error for me.

I want this code:

if ($stm) {
    echo "not exists and create table";
} else {
    echo "exists!"
}

Is it safe to use MongoDB sessions with PHP-FPM (multi-threads)?

I want to use MongoDB sessions to get a causal consistency guarantee.
However I use nginx with PHP-FPM which is multi-threaded. Excluding MongoDB documentation https://docs.mongodb.com/v4.2/core/read-isolation-consistency-recency/ specifies “Applications must ensure that only one thread at a time executes these operations in a client session.”.

So I’m stuck at this level and I don’t really see how to get out of it. The only solution I see
is to make PHP-FPM single thread which I obviously do not want for the advantages it provides.

Do you have any ideas ?

Thank you,