Why I don’t get the Access Token?

I’m try to do login script, where I want to login with the Microsoft OAuth2.0 and Azure Active Directory (or Mirosoft entra ID). The Authentification works and I get the Autorizecode, but the access token is not sent back to my OAuth2.0 provider from the success.php side. I’ve tried so many things like debugging, new code…, but nothing works. By the way, the authorization code is given on the success.php in the path above. Of course, all the data is changed for security reasons.

index.php

<?php

//TODO: Azure Synchronisation 

session_start();

     //* Überprüfen, ob der Benutzer authentifiziert ist
if (isset($_SESSION['token'])) 
{
    header('Location: http://localhost/success.php');  //! Der Benutzer ist bereits authentifiziert
    exit();
}
else
{
header('Location: https://login.microsoftonline.com/a502008d-5bd7-4ad1-b8e0-668da72219a8/oauth2/v2.0/authorize?client_id=XXXXXXXXX&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%2Fsuccess.php&response_mode=query&scope=openid+email+offline_access+profile+User.Read&state=12345&code_challenge=XXXXXXXXXXXXXX&code_challenge_method=S256');  //! Der Benutzer ist bereits authentifiziert
exit();
}
     
//* Überprüfen, ob der Benutzer bereits mit einem Office-Dienst verbunden ist
if (isset($_SERVER['AUTH_USER'])) 
{
sleep(1);
header('Location: http://localhost/success.php'); //! Der Benutzer ist bereits angemeldet
exit();
}



require_once($_SERVER['DOCUMENT_ROOT'].'/Assets/Configs/server.php'); //*Einbinden von server.php
$windowsUser = isset($_SERVER['AUTH_USER']) ? $_SERVER['AUTH_USER'] : null; //*Variable für Authentifizierung
require_once __DIR__.'/vendor/autoload.php'; //* Datei autoload.php einbinden


use LeagueOAuth2ClientProviderGenericProvider; //* Composer (PHP-Bibliothek)

if($windowsUser) 
{
    
    $clientId = 'XXXXXXXXXXXXXXXXX'; //* Anwendungs-ID (Client)
    $clientSecret = 'XXXXXXXXXXXXXXXXX'; //* Geheime Clientschlüssel
    $tenantId = 'XXXXXXXXXXXXXXXXX'; //* Verzeichnis-ID (Mandant)
 
    //* Konfigurationsinformationen für OAuth2-Provider
    $provider = new GenericProvider([
        'clientId'                => $clientId,
        'clientSecret'            => $clientSecret,
        'redirectUri'             => 'http://localhost/success.php', //* UmleitungsURI
        'urlAuthorize'            => "https://login.microsoftonline.com/XXXXXXXXXXXXXXXXX/oauth2/v2.0/authorize?client_id=XXXXXXXXXXXXXXXXX&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%2Fsuccess.php&response_mode=query&scope=openid+email+offline_access+profile+User.Read&state=12345&code_challenge=XXXXXXXXXXXXXXXXX&code_challenge_method=S256",
        'urlAccessToken'          => "https://login.microsoftonline.com/XXXXXXXXXXXXXXXXX/oauth2/v2.0/token",
        'urlResourceOwnerDetails' => '',
        'scopes'                  => ['openid', 'email', 'offline_access', 'profile', 'User.Read'], //* Berechtigungen 
        'codeChallengeMethod'     => 'S256',
    ]);


    if (isset($_GET['code'])) {
        $authorization_code = $_GET['code']; // Autorisierungscode aus GET-Parametern auslesen

        try {
            // Autorisierungscode verwenden, um Zugriffstoken zu erhalten
            $accessToken = $provider->getAccessToken('authorization_code', [
                'code' => $authorization_code,
            ]);

            // JSON-Antwort in ein assoziatives Array umwandeln
            $response = json_decode($accessToken->getBody(), true);
            

            // Zugriffstoken speichern
            $_SESSION['token'] = $accessToken->getToken();
            $_SESSION['id_token'] = $accessToken->getValues()['id_token'];

            $accessTokenValue = $accessToken->getToken();
            $_SESSION['accesstoken'] = $accessTokenValue;

            // Weiterleitung zur Erfolgsseite
            header('Location: http://localhost/success.php');
            exit();
        } catch (LeagueOAuth2ClientProviderExceptionIdentityProviderException $e) {
            
            echo "Fehler beim Abrufen des Zugriffstokens: " . $e->getMessage();
        }
    } else {
        // Benutzer muss sich einloggen und wird dann zu Azure AD weitergeleitet
        $authUrl = $provider->getAuthorizationUrl(); // Autorisierungs-URL abrufen
        header('Location: ' . $authUrl); // Weiterleitung zur Autorisierungs-URL
        exit();
    }
}
?>

Success.php

<!DOCTYPE html>
<html lang="DE">

<?php
session_start();


$username = $_SESSION['user'];
$Erfolg ='Sie haben sich erfolgreich angemeldet';
?>

    <head> 
        <meta charset="UTF-8">
        <link rel="stylesheet" href="Css.css">
        <title>
            Erfolg
        </title>
    </head>
    <body>
        <header>
            <div id="Überschrift">
                <h1>ITH Bolting Technology - Login</h1>
                <?php
                    echo "Benutzer: ";
                    echo($username);
                ?>
            </div>
        </header>
        <main>
            <h3>
                <?php
                    echo($Erfolg);
                    
    // Überprüfen, ob die Anzahl der Benutzer in der Session vorhanden ist
    if(isset($_GET['code'])) {
        $authorization_code = $_GET['code'];
        echo "Autorisierungscode: " . $authorization_code;
    } else {
        echo "Autorisierungscode nicht gefunden.";
    }
    
    
    
    if (isset($_SESSION['user_count'])) {
        echo "<p>Anzahl der Benutzer aus Azure AD: " . $_SESSION['user_count'] . "</p>";
    } else {
        echo "<p>Es wurden keine Benutzer abgerufen.</p>";
    }


    if(isset($_SESSION['accessToken']))
    {
        echo "Access Token: " . $_SESSION['accesstoken']; 
    }
    else
    {
        echo "Es wurde kein Accesstoken gefunden";
    }

                ?>
            </h3>       
        </main>
    </body>

</html>

I am getting an undefined array key message in the update page – how to solve this error? [duplicate]

In the update page when I click the update button this error is showing:

Warning: Undefined array key “updateId”

How to solve this? Here is the code:

<?php
include('connect.php');

//id geting from the url

$id = $_GET['updateId'] ;

$sql = "SELECT * FROM seriescurd WHERE id=$id";
$result = mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);
// echo $row['fname'];

///show whatever the data  come from the database
$f_name = $row['fname'];
$l_name = $row['lname'];
$email = $row['email'];
$mobile = $row['mobile'];

//show updated data
if (isset($_POST['update'])) {
    $f_name = $_POST['f_name']; 
    $l_name = $_POST['l_name'];  
    $email = $_POST['email'];
    $mobile = $_POST['mobile'];
    $sql = "UPDATE `seriescurd` SET `fname`='$f_name',`lname`='$l_name',`email`='$email',
    `mobile`='$mobile' WHERE id='$id'";

    $result = mysqli_query($conn, $sql);
    if ($result) {
        echo "data updated";
    } else {
        die(mysqli_error($conn));
    }
}
   <div class="container my-5">
        <form action="">
            <div class=" form-group mb-3">
                <label>First name</label>
                <input type="text" class="form-control" name="f_name" autocomplete="off" value="<?php echo $f_name ?>">
            </div>
            <div class=" form-group mb-3">
                <label>Last name</label>
                <input type="text" class="form-control" name="l_name" autocomplete="off" value="<?      



php echo $l_name ?>">
            </div>
            <div class="form-group mb-3">
                <label>Email</label>
                <input type="email" class="form-control" name="email" autocomplete="off" value="<?php echo   $email ?>">
            </div>
            <div class=" form-group mb-3">
                <label>mobile</label>
                <input type="text" class="form-control" name="mobile" autocomplete="off"value="<?php echo   $email ?>">
            </div> 
            <button type="submit" class="btn btn-dark btn-lg" name="update">update</button>
        </form>
    </div>

This is the update page code in the index page:

<a href="update.php?updateId=">update</a>

WordPress: delete custom post in frontend with custom user role not working

I am building a custom frontend where custom role members (created with User Role Editor) can add and edit spots.

“Spots” are a custom post type registered like this:

 register_post_type('spot',
   array(
       'labels'          => array( ... ),
       'supports'        => array('title', 'thumbnail', 'revisions'),
       'public'          => true,
       'has_archive'     => true,
       'capability_type' => array('spot', 'spots'),
       'map_meta_cap'    => true,
    )
  );

Now adding and editing these spots works great, but I fail to create a delete link like this:

echo '<a href="'. get_delete_post_link($post->ID) .'">Delete</a>';

This doesn’t echo anything at all unless I am logged in as admin, in which case it works as intended.

I have tried to look into this with current_user_can() with these results:

get_current_user_id() == $post->post_author => true
current_user_can( 'delete_posts', $post->ID ) => true
current_user_can( 'delete_post', $post->ID )  => false
current_user_can( 'delete_spots', $post->ID ) => true
current_user_can( 'delete_spot', $post->ID )  => false

I assume the singular version is correct and that failing the check where my problem lies. But should I query for delete_post or delete_spot?

I am editing the member capabilities with User Role Editor as well and have added both delete_posts and delete_spots capabilities to the role. Other capabilities such as upload_files can be granted and revoked correctly through the interface.

I have to add that I am prohibiting members to access /wp-admin using the User Registration plugin. While lifting the restriction does not make the delete link appear, I have read elsewhere that prohibiting backend access also makes the delete link dysfunctional, as it depends on /wp-admin access. Not sure if this would be true if I could make it appear.

What I’m looking for:

  1. Help with the syntax and some more detailed way to investigate member capabilities. I cannot rule out that I have introduced some permission conflict for the role by trying out different user registration plugins. E.g. where are capabilities stored in the DB and are they human readable?

  2. Another way to make a delete link (perhaps using AJAX?). Not sure if this would work if the proper capability is missing, but if get_delete_post_link() is not compatible with restricting the backend than I would need a different method anyway.

Thank you!

I am using large file upload aws s3 bucket in laravel but i am facing issue [duplicate]

I am using large file upload aws s3 bucket in laravel but i am facing issue “Your proposed upload is smaller than the minimum allowed size” filesize 9.8

public function testS3Link()
{
    $link = "http://localhost/instacon-web/public/videoUpload/sample10mb.mp4";
    $time = time();
    // Destination path on S3 bucket
    $s3FilePath = 'instameet/'.$time.".mp4";

    // Initialize S3 client
    $s3 = new S3Client([
        'version' => 'latest',
        'region' => 'ap-south-1', // Change this to your desired AWS region
        'credentials' => [
            'key' => 'AKIAEXAMPLE',
            'secret' => 'examplekey',
        ],
    ]);

    try {
        // Get file size using cURL
        $ch = curl_init($link);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_NOBODY, true);
        $data = curl_exec($ch);
        $fileSize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
        curl_close($ch);

        // Determine the part size
        $partSize = 5 * 1024 * 1024; // 5 MB
        $partNumber = 1;
        
        // If the file size is smaller than the part size, upload it as a single part
        if ($fileSize <= $partSize) {
            $result = $s3->putObject([
                'Bucket' => 'instacon',
                'Key' => $s3FilePath,
                'Body' => fopen($link, 'rb'),
            ]);
            dd($s3FilePath);
        }
        
        // Initiate the multipart upload
        $result = $s3->createMultipartUpload([
            'Bucket' => 'instacon',
            'Key' => $s3FilePath,
        ]);

        // Get the upload ID
        $uploadId = $result['UploadId'];

        // Upload the parts of the file
        $file = fopen($link, 'rb');
        while (!feof($file)) {
            $part = fread($file, $partSize);
            $result = $s3->uploadPart([
                'Bucket' => 'instacon',
                'Key' => $s3FilePath,
                'UploadId' => $uploadId,
                'PartNumber' => $partNumber,
                'Body' => $part,
            ]);
            $parts[] = [
                'PartNumber' => $partNumber,
                'ETag' => $result['ETag'],
            ];
            $partNumber++;
        }
        fclose($file);

        // Complete the multipart upload
        $s3->completeMultipartUpload([
            'Bucket' => 'instacon',
            'Key' => $s3FilePath,
            'UploadId' => $uploadId,
            'MultipartUpload' => [
                'Parts' => $parts,
            ],
        ]);

        dd($s3FilePath);

    } catch (S3Exception $e) {
        // Handle exception
        echo $e->getMessage();
    }
}

the above code i have tried but its not working. Its return error Your proposed upload is smaller than the minimum allowed size. Can you suggest any solution.

PHP Stripe save for future use not showing UI

First of all I am working from this URL
https://docs.stripe.com/payments/save-and-reuse
I have watched the video on the page. In the video, after clicking the setup button. The Stripe UI comes up. I never get that screen and I have tried different browsers.
The customer is created. The event log shows.

 A new SetupIntent seti_1Ol4kvGznLM7Qekn5jObbbLm was created

The log screen shows a 200 OK POST /v1/checkout/sessions. But the UI never comes up. What am I missing?

 require_once "vendor/autoload.php";

 // Set your secret key. Remember to switch to your live secret key in production.
 // See your keys here: https://dashboard.stripe.com/apikeys
 $stripe = new StripeStripeClient('sk_test_51J5VXM');

 $customer = $stripe->customers->create([
    'description' => 'HealthScribe Client',
    'email' => '[email protected]',
    'name' => 'Jenny Rosen2',
 ]);

 $stripe->checkout->sessions->create([
    'mode' => 'setup',
    'payment_method_types' => ['card'],
    'success_url' => 'https://api.affordablecustomehr.com/stripe/success/?session_id={CHECKOUT_SESSION_ID}',
    'cancel_url' => 'https://api.affordablecustomehr.com/stripe/cancel',
    'customer' => $customer['id']
 ]);

Images are not appearing in content body [closed]

I have an issue in my wordpress website that I need help resolving.

For some reason images on blog post content does not appear on mobile devices.

check this links:
https://www.skillabilly.com/is-industrial-machinery-components-a-good-career-path/
https://skillabilly.com/is-public-utilities-a-good-career-path/

here is a screenshots of the issue:
[enter image description here](https://i.stack.imgur.com/mAKPb.jpg)

I have talked with the host they weren’t able to solve the issue (hostinger)
I have tried to deactivate plugins to solve it but couldn’t find the plugin that might be causing this.
I have added permission to htaccess file as requested from hostinger support.

I expected for the images to appear

i want to convert input string into array using laravel “request” API

i want to convert input field data into array via using laravel request API

<?php

use IlluminateHttpRequest;

class someclass{
function $function( request $request)
{
// input text = car-bus-truck
$GetIncomingFeildInArray = expolde('-', $request->name(array_search('en', $request->lang)));  

print_r($GetIncomingFeildInArray);

//output should be like this , array( [0]=>'car', [1]=>'bus', [2]=> 'truck')

}
}
?>

How to avoid timeout when running time consuming jobs in Laravel

In my laravel application i do a form submit to execute a time consuming task by calling shell_exec(my_time_conusming_Script.sh) . The process executes successfully on the background. But the connection with the frontent is found to be lost. I find that the form submitting the data stops after processing for sometime. I had a return redirect()->back()->with('success',$message); after the shell_exec. But the redirect is not found to be working. if i comment out the time consuming process the redirect works. is any timeout happening. How should i get the redirect working after the time consuming process completes.Should i use laravel queues and jobs and broadcasting.

Error – “Unable to init from given binary data” in Laravel backpack and docker environment

I’m getting this error when uploading jpeg/jpg images. But it works for PNG images. The same code is working on a different server with the same PHP installation. But it is a standard AWS deployment. Currently I’m checking on the dockerized environment. Code as follows:

{

        // 1. Generate a filename.

        $filename = Carbon::now()->format('Y-m-d-His').'.'.'.jpg';

        // 2. Store the image on disk.

        $imageUid = $destination_path.'/'.$filename;

        list($type, $imageData) = explode(';', $value);

        list($type, $imageData) = explode(',', $value);

        $imageData = base64_decode($imageData);

        Storage::disk($disk)->put($imageUid, $imageData);

        // 3. Save the path to the database

        $this->attributes[$attribute_name] = $destination_path.'/'.$filename;



        $thumbImageName = '/thumb-'.basename($imageUid);

        $thumbMiniImageName = '/thumb-mini-'.basename($imageUid);

        $path = 'uploads/user/image/'.$this->uuid;

        $thumbMini = Image::make(env('AWS_S3_URL')  .$imageUid)->fit(56,56)->stream();

        $thumb = Image::make(env('AWS_S3_URL')  .$imageUid)->fit(140,140)->stream();



        Storage::disk('s3')->put($path.$thumbImageName,$thumb->__toString());

        Storage::disk('s3')->put($path.$thumbMiniImageName,$thumbMini->__toString());



        $this->attributes['thumb_uid'] = $path.$thumbImageName;

        $this->attributes['thumb_mini_uid'] = $path.$thumbMiniImageName;

    }

I’m getting error in this line

$thumbMini = Image::make(env('AWS_S3_URL')  .$imageUid)->fit(56,56)->stream();

Sample Image data

"image_uid": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQANq7/Z",

Docker php extensions

RUN apt update && apt install -y supervisor wget git openssh-server unzip postgresql-client libfreetype6-dev libjpeg62-turbo-dev libpq-dev libzip-dev libpng-dev libonig-dev libxml2-dev libcurl4-openssl-dev libssl-dev libjpeg-dev curl cron --no-install-recommends 
        && docker-php-ext-install sockets zip opcache pdo_pgsql mbstring exif gd && docker-php-ext-configure pdo_pgsql --with-pdo-pgsql=/usr/ && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/

enter image description here

PHP – 8.2.7
Laravel – 10.44.0

Can you please a solution if anyone have same experience on this?

Laravel Queue RabbitMQ: Jobs not getting added to the queue when using Quorum queue type

I’m encountering an issue with Laravel Queue RabbitMQ when using the quorum queue type. Here’s the setup:

Laravel version: 10
Package: [vyuldashev/laravel-queue-rabbitmq]
Queue type: Quorum

Issue: Jobs are not being added to the queue after a few minutes of running the application. Specifically, the last 10 to 12 jobs that were supposed to be added to the queue are not getting queued.

I have a Laravel command (JobFakerCommand) that dispatches a specified number of jobs to the queue. Each job is uniquely identified by an ID, and this ID is stored in Redis. When a consumer processes a job, its corresponding ID is removed from Redis.

Here’s the relevant part of the code:

<?php

namespace AppConsoleCommands;

use AppJobsTestSimpleJob;
use CarbonCarbon;
use IlluminateConsoleCommand;
use IlluminateSupportFacadesCache;
use IlluminateSupportStr;

class JobFakerCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'run-job
                            {--count=100 : Number of jobs per run}
                            {--queue=queue1 : queue}
                            {--connection=rabbitmq : queue connection}
                            {--job=Simple : jobName}';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $count = (int) $this->option('count');
        $job = $this->option('job');
        $queue = $this->option('queue');
        $connection = $this->option('connection');
        $time = Carbon::now()->timestamp;

        $jobName = "AppJobs\Test".($job).'Job';
        $i = 0;
        while ($i < $count){
            $uuid = $job."-".$time."-".$i;
            $var = $jobName::dispatch($uuid)->onConnection($connection)->onQueue($queue);
            unset($var);
            Cache::set($uuid , 0);
            $i++;
        }
    }
}
class Kernel extends ConsoleKernel
{
    protected $commands = [
        JobFakerCommand::class,
        WipeStorageCommand::class,
    ];

    protected function schedule(Schedule $schedule)
    {
        $schedule->command(JobFakerCommand::class , ['--count='.env('LongPayloadCount' , 100) , '--job=LongPayload' , '--connection=rabbitmq' , '--queue=queue1'])->runInBackground()->everyMinute();
        $schedule->command(JobFakerCommand::class , ['--count='.env('LongTimeCount' , 100),   '--job=LongTime' , '--connection=rabbitmq' , '--queue=queue2'])->runInBackground()->everyMinute();
        $schedule->command(JobFakerCommand::class , ['--count='.env('SimpleCount' , 100) , '--job=Simple' , '--connection=rabbitmq' , '--queue=queue3'])->runInBackground()->everyMinute();
    }
}

The problem seems to occur only when using the quorum queue type. When using the classic queue type, everything works fine.

What could be causing this issue with the quorum queue type? Any insights or suggestions for troubleshooting would be greatly appreciated. Thank you!

To retrieve ECU software number form tune file

Is there anyway to retrieve ECU software number from tune file using php programming languages.

Example of the ECU software number: SW upg.: 3FAL2000

Any clue will be appreciated from ECU file Expert

I have tried using specific pattern to retrieve software number from ECU tune file using specific pattern

$softwareNumberPatterns = array( '/SWs*:s*([0-9A-Z-]+)/i', // Pattern for "SW:" followed by alphanumeric characters and dashes '/SW upg.s*:s*([0-9A-Z]+)/i', // Pattern for "SW upg.:" followed by alphanumeric characters '/Softwares*Upgrades*:s*([0-9A-Z-]+)/i', // Pattern for "Software Upgrade:" followed by alphanumeric characters and dashes '/Softwares*Versions*:s*([0-9A-Z-]+)/i', // Pattern for "Software Version:" followed by alphanumeric characters and dashes );

Deprecated ReflectionParameter::getClass() Errors After Switching Back to Laravel 5.5 from Laravel 6

After switching from my Laravel 6 branch back to my Laravel 5.5 branch, I’m encountering several deprecation errors related to the ReflectionParameter::getClass() method in my application. The errors are as follows:

Deprecated: Method ReflectionParameter::getClass() is deprecated in /private/var/www/finconnect/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 811
Deprecated: Method ReflectionParameter::getClass() is deprecated in /private/var/www/finconnect/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 885

I have attempted multiple solutions to resolve these errors, including:

Clearing various Laravel caches (php artisan cache:clear, php artisan config:clear, php artisan view:clear)
Removing the vendor directory and reinstalling dependencies (rm -rf vendor/, composer clearcache, composer dump-autoload -o)
The documentation suggests that ReflectionParameter::getClass() is deprecated as of PHP 8, recommending the use of ReflectionParameter::getType() instead. However, I’m currently running PHP 7.3, as confirmed by php -v, and my Valet setup appears to be healthy.

PHP 7.3.33 (cli) (built: Dec 27 2023 06:53:55) ( NTS )

+——————————————+———-+
| Check | Success? |
+——————————————+———-+
| Is Valet fully installed? | Yes |
| Is Valet config valid? | Yes |
| Is Homebrew installed? | Yes |
| Is DnsMasq installed? | Yes |
| Is Dnsmasq running? | Yes |
| Is Dnsmasq running as root? | Yes |
| Is Nginx installed? | Yes |
| Is Nginx running? | Yes |
| Is Nginx running as root? | Yes |
| Is PHP installed? | Yes |
| Is linked PHP ([email protected]) running? | Yes |
| Is linked PHP ([email protected]) running as root? | Yes |
| Is valet.sock present? | Yes |
+——————————————+———-+

I’m puzzled by these deprecation notices since they’re supposed to only apply to PHP 8 and above. Has anyone faced similar issues when working with Laravel 5.5 on PHP 7.3, or does anyone have insights on how to resolve these deprecation warnings? Any help or suggestions would be greatly appreciated.

Is it possible to use putenv in parallel?

For different servers I have created different env variables as constants like this:

#conf.php
    if (getenv('ENV') === 'a_prod' || getenv('ENV') === 'a_local') {
        define("ADMIN_USERNAME", 'connector');
        define("ADMIN_PASSWORD", '1234');
        define("DEFAULT_LANGUAGE", 'EN');
    }
    if (getenv('ENV') === 'a_prod') {
        define("DOMAIN", 'https://example.com');
    }
    if (getenv('ENV') === 'a_local') {
        define("DOMAIN", 'https://127.0.0.1:8000');
    }

    if (getenv('ENV') === 'b_prod' || getenv('ENV') === 'b_local') {
        define("ADMIN_USERNAME", 'connector');
        define("ADMIN_PASSWORD", '5678');
        define("DEFAULT_LANGUAGE", 'DE');
    }

In different files that are executed as cronjobs I use these env variables and constants like this:

#connectorA.php
require 'connector.php';
$connector = new connector('a_prod');

and:

#connectorB.php
require 'connector.php';
$connector = new connector('b_prod');

The connector file look like this:

# connector.php
public function __construct($env)
    {
        echo "nEnv ApiConnector: ". $env;
        putenv("ENV=$env");
        require_once __DIR__ . '/config/conf.php';
    }

Is it possible to run the cronjobs executing “connectorA.php” and “connectorB.php” in parallel?
Somebody said that that would not be possible as the second called cronjob will overwrite the putenv("ENV=$env"); in the connector.php constructor and that they have to be run one after the other.
Is that correct?
If so, should I better use arrays for each configuration?
On the https://www.php.net/manual/en/function.putenv.php site
it states “Adds assignment to the server environment. The environment variable will only exist for the duration of the current request. At the end of the request the environment is restored to its original state.”
So it should be possible, isn’t it?