Docker (compose) nginx and php-fpm – how to set user permissions for mounted files

I have this basic setup for a webserver using php-fpm and nginx. Now, the files are in a given path and I want the files to be editable by the main user but also by the webserver.

Right now, files created by the webserver are listed as “root:root” and I do also not want to change folder permissions to 777, that is not secure. What is the best practice here?

There is a lot on the internet but I cannot find a concrete answer to this problem.

./docker-compose.yml:

services:
    # nginx
    web:
        image: nginx:latest
        ports:
            - "8003:80"
        volumes:
            - /mnt/samba_share_webserver:/var/www/html
            - ./nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
    app:
        build:
            dockerfile: ./php/Dockerfile
        volumes:
            - /mnt/samba_share_webserver:/var/www/html

./php/Dockerfile:

FROM php:8.1-fpm-alpine

RUN docker-php-ext-install pdo pdo_mysql

./nginx/conf.d/default.conf

server {
    listen 80;
    server_name _ localhost;
    root /var/www/html;
    index index.php;

    location ~ .php$ {
       fastcgi_pass   app:9000;
       fastcgi_index  index.php;
       fastcgi_param REQUEST_METHOD $request_method;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include        fastcgi_params;
    }

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

As you can see, the location where the files are stored are placed on a samba share running in another docker container. Those files need to be able to be altered by users making a smb connection.

I’m kind of experimenting and learning about permissions and how to use them. Could anyone give me a direction in for this problem?

How to ignore/exclude dot files, dot folder in phpDocumentor 3?

I have folders and files like this.

index.php
System
  aa.php
.backup
  anything-in-dot-backup.php
.ignoreme.php

I would like to ignore/exclude those dot folders and dot files in phpDocumentor 3 but this config xml seems to not working.

<?xml version="1.0" encoding="UTF-8" ?>
<phpdocumentor
        configVersion="3"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="https://www.phpdoc.org"
>
    <title><![CDATA[My title]]></title>
    <paths>
        <cache>.phpdoc/cache</cache>
        <output>.apidoc</output>
    </paths>
    <version number="latest">
        <api>
            <ignore hidden="false">
                <path>.backup/**/*</path>
                <path>.backup/**/*</path>
                <path>\.backup/**/*</path>
                <path>\.backup/**/*</path>
                <path>.*.php</path>
                <path>Test*/**/*</path>
            </ignore>
        </api>
    </version>
</phpdocumentor>

How to ignore dot folders and dot files in phpDocumentor 3?

Last name capitalization in Laravel/PHP [duplicate]

In an app there is a form where user enter their lastname. These lastnames are later used and I want them to all be written the same. first letter(s) in uppercase, the rest in lowercase.

It looks simple enought but here come the lastnames with multiple parts, sometimes separated by a space, sometimes separated by a dash.

I thought I’ve found the solution with Laravel helper Str::title

Str::title("Cholley"); returns Cholley

Str::title("van basten");returns Van Basten

Str::title("gut-behrami"); returns Gut-Behrami

It was perfect until McDonald and M’Bolhi came along…

Str::title("mcdonald"); returns Macdonald (obviously)

Str::title("m'bolhi"); returns M'bolhi (for this one I have to say my hopes were high)

I’ve tried to manualy insert in the database a &zwj; or a &zwnj; between the ‘C’ and the ‘D’ but it doesn’t work.

Did someone already have and solve this issue ? Do you have any ideas ? someone from Irland maybe…

Any help would be greatly appreciated

Replacing text with skip links in php [duplicate]

Good afternoon, I have a function that replaces text with clickable links from my news, but it also replaces already clickable links in the second round
how to fix?

My code

foreach ( $links as $value ) {

        $register ="";

        if ( comparehosts( urldecode($value['link']), urldecode($_SERVER['REQUEST_URI']) ) ) continue;

        if ( !$value['only_one'] ) $register .="i";
        if ( $config['charset'] == "utf-8" ) $register .= "u";
        if ( $value['targetblank'] ) $targetblank = " target="_blank""; else $targetblank = "";

        if ($value['rcount'] < 1 ) $rcount = -1; else $rcount = intval($value['rcount']);

        if ( !substr_count ($value['word'], "(") ) { 

            $find = "#(^|b|s|<br />)(" . preg_quote( $value['word'], "#" ) . ")(b|s|!|?|.|,|$)#".$register;
            $replace = "\1<a href="{$value['link']}"{$targetblank}>\2</a>\3";

        } else {

            $words = preg_quote( $value['word'], "#" );
            $words = str_replace( '|', "|", $words);
            $words = str_replace( '(', ")(", $words);
            $words = str_replace( ')', ")(", $words);

            if (substr ( $words, - 1, 1 ) == '(') $words = substr ( $words, 0, - 1 );
            if (substr ( $words, - 1, 1 ) != ')') $words .= ')';

            $words = '('.$words;

            $scount = substr_count ($words, "(");
            $rp = "";

            for ($i = 2; $i <= $scount+1; $i++) {
                $rp .= "\".$i;
            }
            
            //preg_replace('/"([A-Za-z0-9? ,_-]+)"(?=[^<>]*(?:<|$))/', "'$1'", $text);

            $find = "#(^|b|s|<br />){$words}(b|s|!|?|.|,|$)#".$register;
            $replace = "\1<a href="{$value['link']}"{$targetblank}>{$rp}</a>\{$i}";

        }


    
    
            $replace_links['all']['find'][] = $find;
            $replace_links['all']['replace'][] = $replace;
            $replace_links['all']['rcount'][] = $rcount;
    
        
    }

    unset ($links);

}

Thanks

I haven’t tried anything yet because I don’t know how

How to migrate a web app from a monolithic to a backend-frontend architecture while keeping both running side-by-side? (PHP, MySQL) [closed]

I have been maintaining for quite some time a monolithic web app written in vanilla PHP, SQL, CSS, and JS (no frameworks used; no external APIs used; in simple terms, it’s just PHP code querying a MySQL database and returning content formatted as HTML). However, I am planning to split it into backend and frontend (not sure what this architecture/design pattern is called, please let me know) because it is becoming hard to maintain and I want flexibility to be able to use the backend with a mobile app later on.

For this, I’ve decided to make a bakend REST API app using the Laravel PHP framework and a Next.js SPA app for the web client. (Nothing unusual.) The REST API will continue to use the same MySQL/MariaDB server, but the database will have a new data schema incompatible with the current monolithic web app version. Therefore I will need to transform the database while the monolithic app continues to run in production.

I want to do this migration to the new architecture incrementally and be able to run the old monolithic app and the new backend and frontend apps (the new “backend-frontend” architecture) running side by side for as long as possible. At the end of the migration, the old version will be phased out and used only for archival purposes (read-only access).

So far, the best way to tackle this I can think of is to replace the MySQL calls inside the PHP code with HTTP requests to the newly developed API routes. As for the database, as of now, I don’t know of any tools to use to transform it (if you can recommend some, please let me know), so if I don’t find a better way, I will export the data from the old database, transform it to conform to the new table structure manually and then import it into the new database.

Is refactoring the backend code of a monolithic app to make use of a backend API instead of directly accessing a DB the standard and best way to migrate to a backend-frontend architecture or is there a better best practice? Some other ideas that have come to my mind are using triggers, database replication, and views. (However, I am not sure they are a good fit because I believe they will only add more complexity and maintainability overhead.)

Jasny SSO: Session has expired. Client must attach with new token

I have 3 brokers using the demo sample code. Two of this brokers run on local virtual hosts. The third runs on a remote server with HTTPS, as the SSO server.

The local brokers works properly (info, login, logout). The remote broker return the error “Session has expired. Client must attach with new token”.

In all cases, the cache files are created, named as SSO-(brokerId)-(token).php.cache and all have the same content.

The problem occurs in Server/GlobalSession.php, method resume(). Session id is provided ans session started, but $_SESSION is empty and the throws the Exception.

Any help?
Thanks

=== Remote broker: error ===

`{“timestamp”:”1707378089″,”channel”:”SSO”,”level”:”DEBUG”,”level_value”:100,”message”:”Validating”,”context”:{“broker”:”Julius”,”token”:”65sueedke8w0sgcoks4gskoksowco4oocgocc0o4wwsw8so0k8″,”code”:”5c00kvp0wzk00kcs048g4ocwc8k84ssg0ckw0404oosgwo8kww”,”checksum”:”1epsadzc5vz4gg8ogkwo8wscockokgwos4kc08k0kgwkowsok4″},”backtrace”:{“file”:”/web/htdocs/test.echosistemi.it/home/sso/src/Server/Server.php”,”line”:109,”class”:”JasnySSOServerServer”,”function”:”startBrokerSession”},”pid”:211}

{“timestamp”:”1707378089″,”channel”:”SSO”,”level”:”DEBUG”,”level_value”:100,”message”:”Resuming”,”context”:{“session”:”ucgu13302vc3ac9av89qr5f7fb”},”backtrace”:{“file”:”/web/htdocs/test.echosistemi.it/home/sso/src/Server/Server.php”,”line”:114,”class”:”JasnySSOServerServer”,”function”:”startBrokerSession”},”pid”:211}
`
=== Local broker: success ===

`{“timestamp”:”1707378221″,”channel”:”SSO”,”level”:”DEBUG”,”level_value”:100,”message”:”Validating”,”context”:{“broker”:”Greg”,”token”:”4wjlaezl8fi8cocgk8w0sgscoos4cog804w4c4o04o8cog4s8s”,”code”:”5uhlf5uwus4c40kw8w0k8sko40wkww04w4kgk0c4k0sg848c4s”,”checksum”:”2zgrk1l3qqucc4k884ccs4scwcswskcw84kgcoksk4owkc408g”},”backtrace”:{“file”:”/web/htdocs/test.echosistemi.it/home/sso/src/Server/Server.php”,”line”:109,”class”:”JasnySSOServerServer”,”function”:”startBrokerSession”},”pid”:247}

{“timestamp”:”1707378221″,”channel”:”SSO”,”level”:”DEBUG”,”level_value”:100,”message”:”Resuming”,”context”:{“session”:”ucgu13302vc3ac9av89qr5f7fb”},”backtrace”:{“file”:”/web/htdocs/test.echosistemi.it/home/sso/src/Server/Server.php”,”line”:114,”class”:”JasnySSOServerServer”,”function”:”startBrokerSession”},”pid”:247}

{“timestamp”:”1707378221″,”channel”:”SSO”,”level”:”DEBUG”,”level_value”:100,”message”:”Resumed”,”context”:{“session”:”ucgu13302vc3ac9av89qr5f7fb”},”backtrace”:{“file”:”/web/htdocs/test.echosistemi.it/home/sso/src/Server/Server.php”,”line”:118,”class”:”JasnySSOServerServer”,”function”:”startBrokerSession”},”pid”:247}

{“timestamp”:”1707378221″,”channel”:”SSO”,”level”:”DEBUG”,”level_value”:100,”message”:”Broker request with session”,”context”:{“broker”:”Greg”,”token”:”4wjlaezl8fi8cocgk8w0sgscoos4cog804w4c4o04o8cog4s8s”,”session”:”ucgu13302vc3ac9av89qr5f7fb”},”backtrace”:{“file”:”/web/htdocs/test.echosistemi.it/home/sso/src/Server/Server.php”,”line”:120,”class”:”JasnySSOServerServer”,”function”:”startBrokerSession”},”pid”:247}

`=== SSO-Greg-4wjlaezl8fi8cocgk8w0sgscoos4cog804w4c4o04o8cog4s8s.php.cache ===

9223372036854775807
s:26:”ucgu13302vc3ac9av89qr5f7fb”;

=== SSO-Julius-65sueedke8w0sgcoks4gskoksowco4oocgocc0o4wwsw8so0k8.php.cache ===

9223372036854775807
s:26:”ucgu13302vc3ac9av89qr5f7fb”;

I’m expecting the remote broker to resume th session properly as it happens with local brokers

Mapping between security.yaml providers and doctrine.yaml connections

In my Symfony project, I configure the security of my application in the security.yaml file, where I define different providers for authentication. In parallel, I have also configured multiple database connections in the doctrine.yaml file to access different databases. My goal is that when a user logs in, they can choose a domain that gives them access to one of three different databases, depending on their choice. Although the databases have the same structure, they do not contain the same data, hence the configuration you can see in the attached files. This configuration is not a choice but a necessity.

To manage the connection to these three databases, I rely on three different routes. Depending on the selected domain, a different route is used. These routes (defined in routes.yaml) are linked to my firewalls in security.yaml, and I link my firewalls to providers to finally associate them with my connections in doctrine.yaml, using the “manager_name” option in the providers. Normally, this option should correspond to the name of my connection in doctrine.yaml.

My routes.yaml :

controllers:
  resource: ../src/Controller/
  type: attribute

app:
  path: /
  controller: AppControllerDefaultController::index
  requirements:
    _method: GET
  options:
    index: true

fallback:
  path: /{url}
  controller: AppControllerDefaultController::index
  requirements:
    url: ".+"
  options:
    index: true

delete_livrable:
  path: /api/deleteLivrable/{id}
  controller: AppControllerLivrableController::deleteLivrable
  methods: DELETE

api_login_check:
  path: /api/login_check

api_login_check_data_processing:
    path: /api/login_check_data_processing

api_login_check_data_intelligence:
    path: /api/login_check_data_intelligence```

My doctrine.yaml :

`
doctrine:
  dbal:
    default_connection: data_metier
    connections:
        data_metier:
            dbname: matrics
            host: localhost
            port: 3306
            url: '%env(resolve:DATABASE_URL)%'
            driver: "pdo_mysql"
            driver_class: AppDBALMyDatabaseDriver
            charset: utf8mb4
            server_version: '15'

        data_processing:
            dbname: 
            host: localhost
            port: 3306
            url: '%env(resolve:DATABASE_DATA_PROCESSING_URL)%'
            driver: "pdo_mysql"
            driver_class: AppDBALMyDatabaseDriver
            charset: utf8mb4
            server_version: '15'

        data_intelligence:
            dbname: matricsdataintelligence
            host: localhost
            port: 3306
            url: '%env(resolve:DATABASE_DATA_INTELLIGENCE_URL)%'
            driver: "pdo_mysql"
            driver_class: AppDBALMyDatabaseDriver
            charset: utf8mb4
            server_version: '15'
  orm:
    default_entity_manager: data_processing
    entity_managers:
        data_metier:
          connection: data_metier
          naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
          mappings:
              App:
                  is_bundle: false
                  dir: '%kernel.project_dir%/src/Entity'
                  prefix: 'AppEntity'
                  alias: App

        data_processing:
          connection: data_processing
          naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
          mappings:
              App:
                  is_bundle: false
                  dir: '%kernel.project_dir%/src/Entity'
                  prefix: 'AppEntity'
                  alias: App

        data_intelligence:
          connection: data_intelligence
          naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
          mappings:
              App:
                  is_bundle: false
                  dir: '%kernel.project_dir%/src/Entity'
                  prefix: 'AppEntity'
                  alias: App

when@test:
  doctrine:
    dbal:
      # "TEST_TOKEN" is typically set by ParaTest
      dbname_suffix: "_test%env(default::TEST_TOKEN)%"

when@prod:
  doctrine:
    orm:
      auto_generate_proxy_classes: false
      proxy_dir: "%kernel.build_dir%/doctrine/orm/Proxies"
      entity_managers:
        data_metier:
          query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
          result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool

        data_processing:
          query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
          result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool

        data_intelligence:
          query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
          result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool

  framework:
    cache:
      pools:
        doctrine.result_cache_pool:
          adapter: cache.app
        doctrine.system_cache_pool:
          adapter: cache.system

`
My security.yaml :

`security:
  enable_authenticator_manager: true
  password_hashers:
    SymfonyComponentSecurityCoreUserPasswordAuthenticatedUserInterface: 'auto'
    AppEntityUser:
      algorithm: auto

  providers:
    data_metier_provider: # Le provider pour "S.I Processing"
      entity:
        class: AppEntityUser
        property: user
        manager_name: data_metier

    data_processing_provider:  # Le provider pour "Data Processing"
      entity:
        class: AppEntityUser
        property: user
        manager_name: data_processing

    data_intelligence_provider:  # Le provider pour "Data Intelligence"
      entity:
        class: AppEntityUser
        property: user
        manager_name: data_intelligence
    
    app_users:
        chain:
            providers: ['data_metier_provider', 'data_processing_provider', 'data_intelligence_provider']
      
  firewalls:
    dev:
      pattern: ^/(_(profiler|wdt)|css|images|js)/
      security: false
    
    login_data_processing:
      pattern: ^/api/login_check_data_processing
      logout: ~
      stateless: true
      json_login:
        provider: data_processing_provider
        check_path: /api/login_check_data_processing
        username_path: user_formLogin
        password_path: password_formLogin
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure
      switch_user:
        provider: data_processing_provider
      context: doctrine.security.switch_user.data_processing.target_path

    login_data_intelligence:
      pattern: ^/api/login_check_data_intelligence
      logout: ~
      stateless: true
      json_login:
        provider: data_intelligence_provider
        check_path: /api/login_check_data_intelligence
        username_path: user_formLogin
        password_path: password_formLogin
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure
      switch_user:
        provider: data_intelligence_provider
      context: doctrine.security.switch_user.data_intelligence.target_path
    
    login:
      pattern: ^/api/login_check
      stateless: true
      logout: ~
      json_login:
        provider: data_metier_provider
        check_path: /api/login_check
        username_path: user_formLogin
        password_path: password_formLogin
        success_handler: lexik_jwt_authentication.handler.authentication_success
        failure_handler: lexik_jwt_authentication.handler.authentication_failure
      switch_user:
        provider: data_metier_provider
      context: doctrine.security.switch_user.data_metier.target_path
    
    api:
      pattern: ^/api
      stateless: true
      jwt:
        provider: app_users

    # Easy way to control access for large sections of your site
    # Note: Only the *first* access control that matches will be used

  access_control:
    - { path: ^/api/login_check_data_processing, roles: PUBLIC_ACCESS }
    - { path: ^/api/login_check_data_intelligence, roles: PUBLIC_ACCESS }
    - { path: ^/api/login_check, roles: PUBLIC_ACCESS }
    - { path: ^/api/login/connect, roles: IS_AUTHENTICATED_FULLY }
    - { path: ^/api, roles: IS_AUTHENTICATED_FULLY }

when@test:
  security:
    password_hashers:
    SymfonyComponentSecurityCoreUserPasswordAuthenticatedUserInterface:
      algorithm: auto
      cost: 4 # Lowest possible value for bcrypt
      time_cost: 3 # Lowest possible value for argon
      memory_cost: 10 # Lowest possible value for argon`

Connections to the different databases work correctly, and my URLs are defined in the .env file. However, the problem lies in the mapping between my providers and my connections. No matter which provider is used (based on the route and firewall), the mapping with the connections in doctrine.yaml always selects the first connection defined in the configuration (for example, the data_metier connection). If I reverse the order of my connections, it selects the one that comes first. Thus, I can manually change databases via the code. But regardless of the choice made by the user, they are always connected to the same database.

So, I would like to know if my configuration contains an error. Is there a best practice for mapping a security provider to a database connection in Symfony? Is it possible to explicitly configure which provider should use which connection? I am also open to other approaches than using the “manager_name” option, as it seems to make no difference at all.

Overall, I’ve attempted to resolve the issues by modifying variable names in cases where a particular character might have caused a problem. I’ve also explored the option of using a single route and thus a single firewall, which I would have linked to the three providers using the “app_users” chain. Although my expectations were low, I still tried this approach. Additionally, I’ve tried to specify as many options as possible in my configurations, in case something was overlooked. Despite all these attempts, I find myself at a standstill and not sure which direction to take next.

I have been facing this issue for several days without finding a solution. I appreciate your help in advance.

How extract folder php

I’m trying to extact a zip folder in php, I’m using ZipArchive for do that but it doesn’t work.

I check the permission and it’s ok
I also check the destination and it’s ok too

 $zip = new ZipArchive();
if ($zip->open($pathShapeFile, ZipArchive::CREATE | ZIPARCHIVE::OVERWRITE)) {
   var_dump($zip);
   $path = pathinfo($pathShapeFile);
   $path_tmp = $path['dirname'] . DS . $path['filename'] . '_dezip';
   if(!is_dir($path_tmp)) {
      mkdir($path_tmp);
      chmod($path_tmp, 0777);
   }

   $extract = $zip->extractTo($path_tmp);
}

The folder of destination is created by it’s empty

$extract return object(ZipArchive)#515 (5) { [“status”]=> int(0) [“statusSys”]=> int(0) [“numFiles”]=> int(0) [“filename”]=> string(50) “/srv/files/shape/Dossier514.zip.zip” [“comment”]=> string(0) “” } and this line “$zip->open($pathShapeFile, ZipArchive::CREATE | ZIPARCHIVE::OVERWRITE)” return true

Deprecate required parameters after optional parameters in function/method

I have update PHPV 7 to PHP 8..1.2 Now whole my application lots of diffrent errors like this.
My main problem is how to solve this issue in the tcpdf library? i have updated the tcpf library the version is “version”: “6.3.2”, please help me fint the solution.

“Deprecated: Optional parameter $isunicode declared before required parameter $currentfont is implicitly treated as a required parameter in C:wamp64wwwprospectertcpdfincludetcpdf_fonts.php on line 2024

Deprecated: Optional parameter $tidy_options declared before required parameter $tagvspaces is implicitly treated as a required parameter in C:wamp64wwwprospectertcpdfincludetcpdf_static.php on line 1139

Deprecated: Optional parameter $prenom declared before required parameter $TheDate is implicitly treated as a required parameter in C:wamp64wwwprospecterclassModules.php on line 929
Deprecated: number_format(): Passing null to parameter #1 ($num) of type float is deprecated

I works neraly 6 months in php so i need help to solve thease issuse in my app.

Woocommerce programmed order does not trigger confirmation email

I create a woordpress plugin that generates a code, links it to a downloadable virtual product. I use this code, once validated to create a woocommerce order in php. When I change the order status the email is never sent to the customer. However, on the production site, customers receive confirmation emails correctly. (The plugin is not on the production site).

I tried to do the status change with :
$order->set_status('completed')
$order->update_status('completed')
I’ve tried to do it manually in the commands dashboard, but it doesn’t change anything.

What I’d like is for the plugin to create a woocommerce order with the customer’s email address when the code is validated. (the customer doesn’t have to have an account to order) The order goes directly to Shipping, and the download email is sent. The customer opens the e-mail and downloads the file. I don’t understand what the problem is, if someone has already come across this problem or if someone has an idea I’d love to hear from you.

I’ll share my code with you:

function ode_cd_traitment_download_code_form()
{
  if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['code']) && isset($_POST['email'])) {
    $code = sanitize_text_field($_POST['code']);
    $email = sanitize_text_field($_POST['email']);
    $remaining_uses = remaining_uses($code);
    $validation_result = ode_cd_validate_data_download_form($code, $email, $remaining_uses);

    if (!empty($validation_result)) {
      return $validation_result;
    } else {
      if (ode_cd_code_exists_in_database($code)) {
        decrement_uses($code);
        $new_remaining_uses = remaining_uses(($code));

        ode_cd_create_order($code, $email);

        wp_redirect(home_url("/test-page/?success=true&remaining_uses=$new_remaining_uses"));
        exit;
      } else {
        return "Le code renseigner est inconnue de notre service.";
      }
    }
  }
}
add_action('init', 'ode_cd_traitment_download_code_form');

function ode_cd_create_order($code, $email)
{

  $product_id = get_product_id_by_unique_code($code);

  $order = wc_create_order();
  $product = wc_get_product($product_id);
  $order->add_product($product, 1);
  $order->set_billing_email($email);
  //$order->set_status('completed');
  $order->save();
  // $order->update_status('completed');
  //$order->save();
}

Have a nice day and thanks in advance to those who reply.

OpenID Connect Unable to verify JWT claims

i have issue while implementing Jumbojett OpenID Authentication. This is my code

$oidc = new OpenIDConnectClient(
                $this->config->item('SSO_PROVIDER_URL'),
                $this->config->item('SSO_CLIENT_ID'),
                $this->config->item('SSO_CLIENT_SECRET')
            );
            $oidc->setVerifyHost(false);    //dev only
            $oidc->setVerifyPeer(false);    //dev only
            $oidc->setHttpUpgradeInsecureRequests(false);   //dev only
            $isAuthenticate = $oidc->authenticate();

The provider url in the config.php file doesn’t have trailing slash.. It looks like this (redacted with *)

$config['SSO_PROVIDER_URL'] = 'https://auth.****.**.id/auth/realms/***ura-**st';
$config['SSO_CLIENT_ID'] = '***ola-****';
$config['SSO_CLIENT_SECRET'] = '********************************';

That code actually works in my local pc, but somehow when i deploy it on the server it keeps throwing me this error

An uncaught Exception was encountered
Type: JumbojettOpenIDConnectClientException

Message: Unable to verify JWT claims

Filename: /var/www/html/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php

Line Number: 373

Backtrace:

File: /var/www/html/application/controllers/Welcome.php
Line: 56
Function: authenticate

File: /var/www/html/index.php
Line: 315
Function: require_once

Please help me, what is wrong?

PHP date manipulation, output multiple dates as formatted string

PHP Dates are wonderful things +1 year for example. However I’m getting myself in a bit of a mess. I have three dates spanning two months and I want to make an elegant string
“28, 29 February & 1 March” from an array of 3 dates in the form YYYYMMDD. The exact number of dates is not known, minimum 1 probable max 4

Other than some rather tortuous str_replace manipulation, how do I get from the output of this to my desired format?

NB: no more than 2 months, maybe all in one month.

$dates_array = ['20240228', '20240229', '20240301'];

foreach ($dates_array as $date) :
  $datetimes[]  = new DateTime($date);
endforeach;

// print_r($datetimes);

foreach ($datetimes as $key=>$date) :
  $month = $date->format('F');
  $day = $date->format('j');                                    
  $date_array[]= $day." ".$month." & ";
endforeach;

$date_string =  join( ' ', $date_array ) ;

echo $date_string;

// 28 February & 29 February & 1 March & 

Link emails to my src code using javascript [closed]

I’d like to link emails to my system so that a non-user can self-register and receive a link to complete registration. I am on a xampp local server. I just want to understand how I can link emails so I can test and confirm.

i.e. I am a new user, I want to register and get a link in my mail for confirmation. Basically I want it to initiate that