php ucfirst not UC the first item of an array

I making a script that takes to first line of a csv file (the headers) and dynamically makes them into the equivalent setter in a class that I created.

Ex. setFirst_name() is the setter in the class

My code would make first_name to look like the setter above as this:

$func = 'set'. ucfirst(trim($export_array[0][$key]));

Here is the first line of the csv file: medicaid_number,first_name,last_name, …

Here is a var_dump() of a portion of the output:

/var/www/html/index.php:145:
string(21) "setmedicaid_number"
/var/www/html/index.php:145:
string(13) "setFirst_name"
/var/www/html/index.php:145:
string(12) "setLast_name"
/var/www/html/index.php:145:
... There is more, they are all OK

Here is the issue, the very first item (and only this item) medicaid_number does not get uppercased. All the other items in array are modified just fine.

Could someone maybe explain why this is happening? or have a solution?

Thank you.

$file="client_export_data.csv";
$csv= file_get_contents($file);
$export_array = array_map("str_getcsv", explode("n", $csv));
foreach($export_array as $lineKey => $line){
    foreach($line as $key => $item){
        $func = 'set'. ucfirst(trim($export_array[0][$key]));
        var_dump($func);
    }
    die();
}

DateTimeImmutable yielding distinct timestamps in distinct PHP runtimes

Running the following script:

var_dump(
    (DateTimeImmutable::createFromFormat(
        format  : 'Y-m-d H:i:s',
        datetime: '2120-10-03 07:00:00',
        timezone: new DateTimeZone('Europe/Zurich')
    ))->getTimestamp()
);

In PHP 8.2 produces the unix epoch timestamp 4757374800, which is correct.

When this script is executed on a server whose PHP version is 5.6, the value we get is incorrect 4757378400 (one hour too late).

Why does this happen?

Same happens if we compute the unix epoch second via:

date_default_timezone_set('Europe/Zurich');
$timestamp = strtotime('2120-10-03 07:00:00 Europe/Zurich');
echo $timestamp;

Undefined method ‘getStream’ SFTP

There is a file I want to read from another server via SFTP and .pem key.
I made connection to server and it was successful now when reading the file from server using this line

// Connect to SFTP
$sftp = new SFTP($host, $port);
if (!$sftp->login($username, $key)) {
    exit('Login Failed');
}

// Read a remote file
$remoteFile = '/path/to/file.log';
$content = $sftp->get($remoteFile);

I am getting below error.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98566176 bytes) in /var/www/Utility/vendor/phpseclib/phpseclib/phpseclib/Net/SFTP.php on line 2461

I tried the following code

$stream = $sftp->getStream('largefile.dat');
if ($stream) {
    while (!feof($stream)) {
        $chunk = fread($stream, 8192);
        // Process $chunk
    }
    fclose($stream);
}

But it gives the error

Undefined method ‘getStream’.intelephense(P1013)

I tried checking everything php phpseclib installation is proper.

curl can connect to repo.packagist.org via HTTP but fails with HTTPS [duplicate]

When I use curl https://repo.packagist.org/packages.json,get this error:

curl: (28) Failed to connect to repo.packagist.org port 443 after 21050 ms: Could not connect to server

But when using curl http://repo.packagist.org/packages.json, it correctly worked!

> {"packages":[],"notify-batch":"https://packagist.org/downloads/","providers-url":"/p/%package%$%hash%.json","metadata-url":"/p2/%package%.json","metadata-changes-url":"https://packagist.org/metadata/changes.json","search":"https://packagist.org/search.json?q=%query%&type=%type%","list":"https://packagist.org/packages/list.json","security-advisories":{"metadata":true,"api-url":"https://packagist.org/api/security-advisories/"},"providers-api":"https://packagist.org/providers/%package%.json","warning":"Support
> for Composer 1 will be shutdown on August 1st 2025. You should upgrade
> to Composer 2. See
> https://blog.packagist.com/shutting-down-packagist-org-support-for-composer-1-x/","warning-versions":"<1.99","provider-includes":{"p/provider-2013$%hash%.json":{"sha256":"a2b47ec1a1bb999e53d88aff50728aebbd3d68225c74aab1ff5f071bac42f5b7"},"p/provider-2014$%hash%.json":{"sha256":"347426977f09ca7feb7306fd990c2db8bf28b3f3d57716f8b90a12f1c21f1065"},"p/provider-2015$%hash%.json":{"sha256":"d9fa6571b23af36e89a1f73eb3be340c81743ae5b71e523cf228552d8e02d029"},"p/provider-2016$%hash%.json":{"sha256":"27c3687c41821dca9f6d65a0ca636ae6675120d4f045d132a097d8c0311818d4"},"p/provider-2017$%hash%.json":{"sha256":"f82637fef38646359f09365a7aef1bcbdf7db5d63b0511b3a1f9f8f58a9c2854"},"p/provider-2018$%hash%.json":{"sha256":"f4870961f191584a8e58a5683ef5882459e5f66ea2d70881750a53400b401857"},"p/provider-2019$%hash%.json":{"sha256":"70145dae32ee55bd86351b2e7520fd573c642917b7787009bb5b13bfa7208517"},"p/provider-2020$%hash%.json":{"sha256":"261d9f1aaca76417647dad0922781fffeac007531dffd9d5ff8eea9b69826430"},"p/provider-2021$%hash%.json":{"sha256":"231acb00ca80397db2f2ed9cfdaa7045839584e9f39dd03b87b9cebbb9ccf5d7"},"p/provider-2022$%hash%.json":{"sha256":"fbd72f659dbd3b7f28c2f4a03bb903759e1d7641c300e1eaea0dec25bd05683e"},"p/provider-2023$%hash%.json":{"sha256":"0b8c3c321c716153c450fe69d8fd4d23279fdc451212e28ccccbb25db0aef094"},"p/provider-2024$%hash%.json":{"sha256":"745def0c1dd86019d31400fa0899b9293bc5c9bc5ab2c790866cb365dcbb16f8"},"p/provider-2024-04$%hash%.json":{"sha256":"1128944b800d6c07420ddbe33aa14667f2ef6ea0833cddf84b92ca96ac3078d8"},"p/provider-2024-07$%hash%.json":{"sha256":"3582960dd2ea8d007e7e1bfb07938b08ab5a4179332d0ec65424a506332b8197"},"p/provider-2024-10$%hash%.json":{"sha256":"82ea763e72f57755471cf9a4cb2f99f7ef7a15b9675146528fb041a4345d3df1"},"p/provider-2025-01$%hash%.json":{"sha256":"f11d8fd77adedb70d261f92a09242b68ab67019920f6ec4fb8868bca6ab098aa"},"p/provider-archived$%hash%.json":{"sha256":"8bb3f3566d1b440250f124cb7e56479912c1ebc3471ac2924bf94382101d06a4"},"p/provider-latest$%hash%.json":{"sha256":"d2d84dcbc41a33a96cc1a39c91a29861f33e93ec0c1086c04754663eaad831c5"}}}

How do I make curl understand that it should work with https?

OpenCart 4.x: AJAX request returns “Invalid token session” despite valid user_token

I’m developing a custom OpenCart 4.x module that adds a button to the order page to log order data via AJAX. The button makes a GET request to my custom controller, but I’m getting an “Invalid token session” error despite passing a valid user_token.

Button in order_info.twig:

$('#log-order-button').on('click', function() {
    const orderId = '{{ order_id }}';
    
    $.ajax({
        url: 'index.php?route=extension/module/log_order/log&user_token={{ user_token }}&order_id=' + orderId,
        type: 'GET',
        dataType: 'json',
        success: function(json) {
            // handle response
        },
        error: function(xhr, status, error) {
            // handle error
        }
    });
});

Controller

<?php
namespace OpencartAdminControllerExtensionModule;

class log_order extends OpencartSystemEngineController
{
    public function log(): void
    {
        $json = array();

        // Check if user is logged in and has permission
        if (!isset($this->request->get['user_token']) || !$this->user->isLogged()) {
            $json['error'] = 'Permission denied or not logged in.';
        } elseif (!$this->user->hasPermission('modify', 'sale/order')) {
            $json['error'] = 'You do not have permission to modify orders.';
        } else {
            // Process order logging
        }

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }
}

When I click the button, the AJAX request goes to:
http://localhost/admin123/index.php?route=extension/module/log_order/log&user_token=bcaa4bb96fb680351565d57951b2ef79&order_id=2

But instead of reaching my controller, I get “401 Unauthorized”
What I’ve Tried:

  • Verified user_token: The token is being passed correctly from the template
  • Session check: The user is logged in and can access other admin pages
  • Permission check: The user has modify permissions for orders
  • Route verification: The controller file exists in the correct location

OpenCart 4.1.0.3

Laravel Eloquent fails to insert Unicode (emoji) into NVARCHAR column on SQL Server – only works with query builder

I’m working on a Laravel 8 project that connects to Microsoft SQL Server 2017 (running on Windows Server 2012 R2) using PHP 7.4.9 and the sqlsrv/pdo_sqlsrv drivers. My goal is to insert Unicode characters (e.g., emoji like ✅) into a column defined as NVARCHAR.

When I insert using Laravel’s Query Builder:

DB::table('cabang')->insert(['kodecabang' => '✅']);

The Unicode characters are inserted correctly into the NVARCHAR column.

When I use Eloquent:

$cabang = new AppModelsCabang();
$cabang->kodecabang = '✅';
$cabang->save();

The character becomes corrupted (?, , etc), or I sometimes get:

Malformed UTF-8 characters, possibly incorrectly encoded

What I’ve Confirmed & Tried

  • The target column is NVARCHAR
  • Laravel DB config uses ‘charset’ => ‘utf8’
  • Data is UTF-8 valid (verified via mb_check_encoding, iconv, etc.)
  • Tried filtering and re-encoding strings before save (via Eloquent trait, middleware, model event saving())
  • Using Laravel 8 Eloquent models and default connection
  • Files are saved as UTF-8 without BOM
  • I tried forcing conversions like:
iconv('UTF-8', 'UTF-8//IGNORE', $value)

Still no luck — the saved character is not the emoji, but broken.

  • Inserting N’✅’ directly in SQL Server (SSMS) works fine
  • Using raw DB::statement with N'...' also works
  • I noticed that neither my local nor server environment shows ExtensionVer when running php -i | find "sqlsrv".
    However, Unicode insert via Eloquent works on local, but fails on the server.
    This suggests the issue may not solely be the driver version, but perhaps the environment, OS-level encoding support, or how the driver is installed/configured on the server.

My Questions

  1. Does Laravel Eloquent or the PDO SQLSRV driver support Unicode binding correctly for NVARCHAR?
  2. Is it possible to make Eloquent insert Unicode data with the N’…’ prefix for NVARCHAR?
  3. Is the root cause likely my pdo_sqlsrv driver being outdated or not from Microsoft?
  4. Is switching to the official Microsoft SQLSRV drivers the only reliable solution to store Unicode via Eloquent ORM?

Notes

  • I can’t rewrite the app to use DB::table() everywhere — it’s large and uses models extensively.
  • I’m trying to find a way to store emoji via $model->save() reliably.
  • Any ideas to force or simulate the Unicode-aware binding via Eloquent would be appreciated.

Thanks in advance for any insights or workaround!

dynamically change which anchor (*composer-install or *composer-update) is used based on $PHP_VERSION in gitlab CI

Here, I have added a snippet of .gitlab-ci.yml, which is performing unit tests for different PHP versions.

So, for the unit test, it is installing the composer dependencies based on different PHP versions.

Now, I want to install composer (*composer-install) when PHP_VERSION = 7.4 otherwise composer update (*composer-update)

I am expecting a solution on how to add anchors conditionally. If not, do we have any alternative method except the one mentioned?

Existing configuration:

.install-composer-script: &install-composer-script
  - composer install
  - composer bin all install

.update-composer-script: &update-composer-script
  - composer update

.composer-install: &composer-install
  before_script:
    - echo 'APP_ENV=gitlab-ci' >> .env
    - ssh-keygen -t rsa -f ./data/id_rsa -q -P ""
    - *install-composer-script
    - composer build-phar
  <<: *unit-tests

.composer-update: &composer-update
  before_script:
    - echo 'APP_ENV=gitlab-ci' >> .env
    - ssh-keygen -t rsa -f ./data/id_rsa -q -P ""
    - *update-composer-script
    - *install-composer-script
    - composer build-phar
  <<: *unit-tests

unit-tests-php74-84:
  image: docker-php-image:php-${PHP_VERSION}
  allow_failure: false
  needs:
    - composer
  before_script:
    - echo 'APP_ENV=gitlab-ci' >> .env
    - ssh-keygen -t rsa -f ./data/id_rsa -q -P ""
    - |
        if [ "$PHP_VERSION" != "7.4" ]; then
          composer update $COMPOSER_FLAGS
        fi;
    - *install-composer-script
    - composer build-phar
  <<: *unit-tests
  parallel:
    matrix:
      - PHP_VERSION: "7.4"
      - PHP_VERSION: "8.0"
      - PHP_VERSION: "8.1"
      - PHP_VERSION: "8.2"
      - PHP_VERSION: "8.3"
      - PHP_VERSION: "8.4"

**Is Working:
before_script:
    - echo 'APP_ENV=gitlab-ci' >> .env
    - ssh-keygen -t rsa -f ./data/id_rsa -q -P ""
    - |
        if [ "$PHP_VERSION" != "7.4" ]; then
          composer update $COMPOSER_FLAGS
        fi;
    - *install-composer-script
    - composer build-phar

**But, I want something like:

unit-tests-php74-84:
  image: docker-php-image:php-${PHP_VERSION}
  allow_failure: false
  needs:
    - composer
  before_script:
    - if $PHP_VERSION" != "7.4" then *composer-install
    - else *composer-update
  <<: *unit-tests
  parallel:
    matrix:
      - PHP_VERSION: "7.4"
      - PHP_VERSION: "8.0"
      - PHP_VERSION: "8.1"
      - PHP_VERSION: "8.2"
      - PHP_VERSION: "8.3"
      - PHP_VERSION: "8.4"

Flutter HTTP Request Error: ClientException with SocketException (Connection timed out) to PHP API on Local Server

When I try to send a POST request to my login API (login.php), I get the following error in Flutter:
ClientException with SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = 192.168.51.31, port = 43832, uri=http://192.168.51.31/stray-dog//login.php

My Setup:

Flutter frontend

PHP API (login.php) hosted on local server

MySQL database

Local network Wi-Fi

API URL used: http://192.168.51.31/stray-dog//login.php

What I’ve Tried:

Confirmed that the server is running and accessible via browser from the development machine.

Verified device and server are on the same network.

Checked firewall and port blocking settings.

Tested the API using Postman from the development machine (it works).

Used emulator and real device for testing; same error occurs.

Any help or suggestions are appreciated!

AI and ML implement in Laravel framework Getting Error Getting AI service failed [closed]

Laravel for AI and ML applications.

Installed this one:

composer create-project –prefer-dist laravel/laravel ai-ml-app

I have Used bellow code but its also not working.

<?php
namespace AppHttpControllers;

use IlluminateHttpRequest;
use IlluminateSupportFacadesHttp;

class AiController extends Controller
{
    public function sentiment(Request $req)
    {
        $res = Http::post(config('ai.url') . '/analyze', ['text' => $req->message]);
        if ($res->failed()) {
            return response()->json(['error' => 'AI service failed'], 500);
        }
        return response()->json([
            'message' => $req->message,
            'ai' => $res->json()
        ]);
    }
}

But its not working Please provide me all steps those are I need to follow for Laravel framework.

I follow these steps also https://www.bacancytechnology.com/blog/laravel-with-ai-ml but its not working

phpMyAdmin OIDC Authentication with OAuth2-Proxy causing redirect loop between login and SignonURL page

I’m currently running phpMyAdmin and OAuth2-Proxy in my kubernetes cluster. OIDC authentication is working just fine, I’ve verified that PMA_USERNAME is being set properly, and I’m being authenticated by my IDP. However, I’m getting a too many redirect error, it seems like I’m stuck in a loop between /database/ and my /database/scripts/signon.php. As you can see below, I’ve tried everything so please excuse any unnecessary additions. Thanks in advance!

phpmyadmin-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: phpmyadmin
  labels:
    app: phpmyadmin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: phpmyadmin
  template:
    metadata:
      labels:
        app: phpmyadmin
    spec:
      containers:
        - name: phpmyadmin
          # image: phpmyadmin/phpmyadmin:latest
          image: phpmyadmin/phpmyadmin:5.2.1
          ports:
            - containerPort: 80
          env:
            - name: PMA_HOST
              value: "<DATABASE DNS>"
            - name: PMA_PORT
              value: "<DB PORT>"
            - name: PMA_ABSOLUTE_URI
              value: "https://<My Database URL>/database/"
            - name: PMA_ARBITRARY
              value: "0"
          lifecycle:
            postStart:
              exec:
                command:
                  - sh
                  - -c
                  - |
                    set -x  # Enable verbose output

                    # Disable username on login screen                    
                    sed -i 's/name="pma_username"/name="pma_username" disabled="disabled"/g' "/var/www/html/templates/login/form.twig"


                    # Create the directories
                    mkdir -p /etc/phpmyadmin/conf.d
                    mkdir -p /var/www/html/scripts

                    # Create the new config file
                    cat <<EOF > /etc/phpmyadmin/conf.d/config.signon.inc.php
                    <?php
                    for ($i = 1; isset($hosts[$i - 1]); $i++) {
                      $cfg['Servers'][$i]['auth_type'] = 'signon';
                      $cfg['Servers'][$i]['SignonURL'] = 'scripts/signon.php';
                      $cfg['Servers'][$i]['cookie_name'] = 'phpMyAdmin_https';
                    }
                    ?>
                    EOF

                    # Create the signon.php script
                    cat <<EOF > /var/www/html/scripts/signon.php
                    <?php
                    session_start();

                    // Check if the X-Auth-Request-Email header is present
                    if (isset($_SERVER['HTTP_X_AUTH_REQUEST_EMAIL'])) {
                      $username = $_SERVER['HTTP_X_AUTH_REQUEST_EMAIL'];

                      // Set the Session Variables
                      $_SESSION['pma_username'] = $username;

                      // Redirect to phpMyAdmin
                      error_log("Complete  _SERVER array: " . print_r($_SERVER, true));
                      header("Location: /database/");
                      exit;
                    } else {
                      // Handle the case where the header is missing
                      error_log("Complete  _SERVER array: " . print_r($_SERVER, true));
                      die("Access denied: Not authenticated by OAuth2-Proxy");
                    }
                    ?>
                    EOF
                    
                    # Change ownership to www-www-data
                    chown -R www-data:www-data /etc/phpmyadmin/conf.d
                    chown -R www-data:www-data /var/www/html/scripts

phpmyadmin-ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: phpmyadmin-ingress
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
    nginx.ingress.kubernetes.io/auth-url: http://oauth2-proxy.ingress-nginx.svc.cluster.local/oauth2/auth
    nginx.ingress.kubernetes.io/auth-signin: https://<My Database URL>/oauth2/start?rd=https://$host$request_uri
    nginx.ingress.kubernetes.io/auth-response-headers: "X-Auth-Request-Email"

spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - <My Database URL>
      secretName: <TLS SECRET>
  rules:
    - host: <My Database URL>
      http:
        paths:
          - path: /database(/|$)(.*)
            pathType: ImplementationSpecific
            backend:
              service:
                name: phpmyadmin-service
                port:
                  number: 80

oidc-values.yaml

config:
  existingSecret: oauth2-secret # includes client-id, client-secret, and cookie-secret

  configFile: |
    provider = "oidc"
    set_xauthrequest = true
    oidc_issuer_url = "https://<IDP URL>/oidc/<My Database URL>"
    email_domains = ["*"]
    cookie_secure = true
    upstreams = ["http://phpmyadmin.default.svc.cluster.local"]
    redirect_url = "https://<My Database URL>/oauth2/callback"
    #scope = "openid email profile"
    scope = "openid"
    profile_url = "https://<IDP URL>/oidc/<My Database URL>/userinfo"
    user_id_claim = "mail"
    pass_access_token = true
    pass_authorization_header = true
    pass_user_headers = true
    set_authorization_header = true
    cookie_domains = "<My Database URL>"
    #cookie_name = "_oauth2_proxy"
    cookie_refresh = "2m"
    cookie_expire = "24h"
    cookie_csrf_per_request= true
    cookie_csrf_expire = "5m"

extraArgs:
  - --cookie-secure=true
  - --cookie-samesite=lax
  - --whitelist-domain=<My Database URL>
  - --skip-provider-button
  - --user-id-claim=mail

ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: nginx
  hosts:
    - <My Database URL>
  path: /oauth2

SMTPUser in the Email config and setFrom can be different in Codeigniter 4 application?

I am working on a CodeIgniter application and trying to send emails with different from addresses for different purposes:

Below is one of the controller codes for email sending:

$email = ConfigServices::email();
$email->setFrom('[email protected]');
$email->setTo('[email protected]');
$email->setSubject('Test subject');
$email->setMessage('Test msg body');
$email->send();

Here I want to use the mail address: [email protected] as the from(sender) address.

However, when I use the above-mentioned code, the email sending fails(seems not sending).
If I change the from address to [email protected], it works perfectly.

My app/Config/Email.php is as follows:

public string $protocol = 'smtp';

public string $mailPath = '/usr/sbin/sendmail';

public string $SMTPHost = 'smtp.hostinger.com';

public string $SMTPUser = '[email protected]';

public string $SMTPPass = 'XXXXXXXX';

public int $SMTPPort = 465;

Can anyone please guide me on what is wrong with my script? Or does Codeigniter support this setting for the from address?

chmod() and utime error keep occurring in the site even after the permissions and ownerships are set

I am working on a client site, In the wordpress theme file I have added a cron.php file to perform some cron job functions. It was executing fine without any issues till last few days. When I checked The cron file execution is not happening when I try to execute the file from server I got an error

PHP Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTPConnection, null given
in wp-admin/includes/class-wp-filesystem-ftpext.php:438

Stack trace:
#0 wp-admin/includes/class-wp-filesystem-ftpext.php(438): ftp_nlist()
#1 wp-admin/includes/class-wp-filesystem-ftpext.php(456): WP_Filesystem_FTPext->exists()
#2 wp-content/plugins/woocommerce/.../File.php:254: WP_Filesystem_FTPext->is_file()
#3 wp-content/plugins/woocommerce/.../File.php:437: File->is_writable()
#4 wp-content/plugins/woocommerce/.../FileController.php:135: File->write()
#5 wp-content/plugins/woocommerce/.../LogHandlerFileV2.php:60: FileController->write_to_file()
#6 wp-content/plugins/woocommerce/includes/class-wc-logger.php:189: LogHandlerFileV2->handle()
#7 wp-content/plugins/woocommerce/includes/class-wc-logger.php:251: WC_Logger->log()
#8 wp-content/plugins/woocommerce/.../FeaturesUtil.php:62: WC_Logger->error()
#9 wp-content/plugins/woocommerce/includes/class-woocommerce.php:836: do_action() → WooCommerce->init()

When I checked for the solutions after going through some multiple sources I found adding define('fs_method', direct) could fix the issue, I have added that and set the ownership and permission through server using this

sudo chown -R www-data:www-data /path/to/wordpress
find /path/to/wordpress -type d -exec chmod 755 {} ;
find /path/to/wordpress -type f -exec chmod 644 {} ;
chmod 775 /path/to/wordpress/wp-content/uploads/wc-logs

For a while the issue seems to be fixed and the cron jobs where done without any problem, after few hours I started getting these warnings on the site

PHP Warning: touch(): Utime failed: Operation not permitted 
in wp-admin/includes/class-wp-filesystem-direct.php on line 529

PHP Warning: chmod(): Operation not permitted 
in wp-admin/includes/class-wp-filesystem-direct.php on line 173

When I set the permissions and ownership again the issue will go for a while but keeps happening after some time. Need a proper fix for the issue gone through multiple forums and blogs and the solution I get is the same.

WooCommerce flagged the error as a bug https://github.com/woocommerce/woocommerce/issues/58985

PHP Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTPConnection, null givenin wp-admin/includes/class-wp-filesystem-ftpext.php:438

Really needs some help regarding this

Hotmart – issues to send order via API from my website to hotmart

I am using Laravel 12 with mysql and deploying my solution using docker to coolify. The payment process I want to setup using Hotmart. I have finished a product configuration and I want to use hotmart API to send Orders. I do not want to use the hotmart checkout page because the experience for the users is not good. I want seamless and integrated solution. Using API I can share my credentials and get back an temporary token, which I tried to use to send an order. The API status return 200 – success, but there is not content in the response. Nothing happened.

example of request command:

{"method":"post","url":"https://developers.hotmart.com/payments/api/v1/subscriptions","data":{"buyer":{"name": ......

example of return:

{"status":200,"content_type":"","is_json":false,"body":""} 

I’ve tried many different endpoints. Anyone here have experienced a simular issue and can contribute to the solution? Many thanks in advanced.

how to catch all $_GET variables which have certain value [duplicate]

I have many $_GET parameters in url which i want to filter.
Like:

?article=123456
?search=bill
?category=general

?add_article=1
?add_archive=1
?add_biography=1

I want to exclude all GET variables which have 1 as value

Instead of

if( $_GET['add_article'] != 1 && $_GET['add_archive'] != 1 && $_GET['add_biography'] != 1) {
// show content for other GET variables

I tried this:

if( array_values($_GET) != 1) {
// show content for other GET variables

But this does not work. How can i achieve this easyly?

Is there a way to setup a static for situations when WordPress site hosted on Cloudways goes down? [closed]

Hi I’m interning at a small business and we experienced a server crash on Cloudways end and we had no way to communicate with customers that our site was down. I’m not a senior developer or anything but know my way around html, css and some php. Is there a way to setup a static page so that it’s displayed when we experience a server crash?

I know how to create a 404 error page which just need a redirection using a .htacess file although I’m not sure how this would work at a server level. Is it possible?