Skip to main content

PHP Collective

Questions

Browse questions with relevant PHP tags

1,464,505 questions

3 votes
1 answer
91 views

Cannot get gettext to work in php:fpm-8.2 Docker Container

I've checked on the questions regarding this issue, they did not help (see what I tried below). I setup a multi-container app on docker with a httpd:2.4 (apache) container acting as reverse-proxy ...
DevelJoe's user avatar
  • 1,552
1 vote
1 answer
76 views

Preload Image Warning

I am getting a warning about a preload link for a background image on WordPress most likely caused by a previously installed theme or by a current Elementor theme kit. The warning states that this ...
MWMoriarty's user avatar
  • 1,001
2 votes
1 answer
53 views

PhpUnit overwrite server variables from XML

I have following server variable in phpunit.xml: <php> <server name="APP_DEBUG" value="false"/> </php> Sometimes while developing, I want have APP_DEBUG ...
Justinas's user avatar
  • 43.9k
1 vote
0 answers
75 views

WordPress REST API: Large Image Uploads Not Reaching Backend Despite Proper PHP Settings

Problem Description: I'm developing a chat application with image upload functionality using WordPress REST API. When users attach multiple large images (3 images), the request doesn't reach the ...
user29255210's user avatar
2 votes
1 answer
174 views

Why does doctrine/doctrine-bundle cause errors in my symfony / composer project after upgrade?

When trying to do a "composer upgrade", it fails in "@auto-scripts" when reaching doctrine/doctrine-bundle. The error is: Executing script cache:clear [KO] [KO] Script cache:clear ...
Werdck's user avatar
  • 95
0 votes
2 answers
85 views

How to assign single product template to product by its category (WordPress/ WooCommerce/ Block theme)

I tried to assign single product template to product by its category. I had searched for similar questions but found answers in classic theme. Below are 2 examples of several codes that Gemini gave me ...
FUFY's user avatar
  • 19
3 votes
1 answer
225 views

Is there a good way to gracefully handle bad method calls in Livewire?

I'm making most of my components extend from an abstract class where I register some exception handling using the exception lifecycle hook: use App\Livewire\BaseComponent; class MyComponent extends ...
IGP's user avatar
  • 16.4k
0 votes
0 answers
48 views

curl_exec download fails if filename contains +sign [duplicate]

I am using following code to trigger download from browser on button click: header("Content-Disposition: attachment; filename=".$_GET['name']); $url = $_GET['name']; $url= ...
Toniq's user avatar
  • 5,158
2 votes
0 answers
58 views

Permission 'cloudmessaging.messages.create' denied on resource '//cloudresourcemanager.googleapis.com/projects/xxxxx' (or it may not exist)

I'm encountering a permission error when calling the Firebase Cloud Messaging (FCM) API for notifications. While the API retrieves details and generates a Firebase token successfully, the response ...
naseeba c's user avatar
  • 1,060
2 votes
0 answers
58 views

How to properly handle native JavaScript confirm() in Laravel Dusk without triggering UnexpectedAlertOpenException

I’m writing a Laravel Dusk browser test for a “Delete Contact” button that shows a native JavaScript confirm() dialog before deleting a record. However, every time the test runs, I get this error: ...
Nken Mandeng Ange Arsene's user avatar
0 votes
0 answers
76 views

VSCODE PHP debug not showing variable values when filename does not end in .php

I have the following simple php test file: <?php $a = 1 ; $debug = true ; This file has two linked filenames: testa and testa.php I have set both of these files with a breakpoint at the third ...
Dennis 's user avatar
  • 1,280
0 votes
1 answer
108 views

How do I join and select from a many-to-many relation?

I have tables Properties and Features with many-to-many relationship PropertiesFeatures (which holds their IDs): When I select multiple features (feature IDs) as an array, I need all properties which ...
linuxoid's user avatar
  • 1,447
-1 votes
2 answers
59 views

Wordpress critical error "Uncaught Error: Class "_WP_Dependency" not found in class-wp-dependencies.php:260 - no changes made to site [closed]

I’ve just discovered that my wordpress site is throwing a critical error. I last published a post yesterday and it was fine. I haven’t made any changes to the site, code, themes, or plugins since then....
Avery's user avatar
  • 15
0 votes
1 answer
73 views

WordPress REST API: HTML content loses styling when Elementor is active

Stuck on an automation issue and hoping someone here has dealt with this. Setup: n8n automation that generates HTML content (articles in Hebrew) Sending to WordPress via REST API WordPress site ...
Daniel Rozin's user avatar
0 votes
2 answers
129 views

Create a custom method for all existing product types in WooCommerce

I want to create a custom method I can use for any WC_Product class, so I can use $product->get_lead_time(); anytime I have a product object available. I currently have it working for Simple ...
Alexandra Chavez's user avatar
0 votes
1 answer
65 views

Apache LDAP authentication has isUserInRole method?

On different servers, I have applications in PHP and Java (other languages too). I am developing all new applications to use LDAP authentication so I don't have to do any user management, but more ...
Hussain Akbar's user avatar
1 vote
0 answers
43 views

Spread operator without array as a function/method argument [duplicate]

While browsing the Symfony CurlHttpClient I found this line of code: $this->defaultOptions['buffer'] ??= self::shouldBuffer(...); I have never seen the spread syntax without an array following it (...
JRLH's user avatar
  • 11
5 votes
1 answer
169 views

Set SQL Server LoginTimeout in Laravel

I've encountered a problem in my Laravel 12 project. I usually save my data in a remote SQL Server database, but I have to consider the case of a db server malfunction. I have a backup local ...
iLux24's user avatar
  • 85
0 votes
1 answer
75 views

Laratrust role not updating until php artisan optimize:clear

I’m using Laravel 11 with Laratrust v8.3, and I’ve noticed something strange on my production server. When I assign or update a user’s role, it doesn’t take effect immediately — the user still has the ...
Chithira Kumar M's user avatar
0 votes
1 answer
85 views

Behat thinks that steps are missing in the FeatureContext [closed]

Windows 10, PHP 8.4.13, Behat 3.25.0.0. File features/basket.feature: Feature: Product basket In order to buy products As a customer I need to be able to put interesting products into a basket ...
yesnik's user avatar
  • 4,793
-1 votes
1 answer
62 views

Change the case of Search Results to "Title Case"

I have made all my post titles title case with the code. It worked fine. But the search query title case is not there. So I want to change the below search_query code to Title Case. So I want to <?...
Geovanny Okuneva's user avatar
0 votes
0 answers
35 views

How do I access my Project folder inside my Wamp www folder? [duplicate]

I keep getting this error in wamp server whenever i try to access my login_form.php file in localhost and I also keep getting a error saying forbidden i dont have access to this resource I tried ...
Talal Azeem's user avatar
0 votes
0 answers
127 views

React Native fetch is returning an error, but the character causing the error isn't in the returned JSON

I am doing a fetch in React Native and am very new to React Native, by the way. const apiUrl = 'http://hermes.hstn.me/api/'; const response = await fetch(apiUrl, { method: 'GET', headers: { '...
mycroft16's user avatar
  • 835
1 vote
1 answer
133 views

php's readline() method adding weird line breaks when executed via shell?

So I have this really weird issue where I have the following dummy.php script: <?php declare(strict_types=1); $prompt = "Hello there!". PHP_EOL . "What do you want to know?"...
DevelJoe's user avatar
  • 1,552
-3 votes
1 answer
280 views

Why are these simple MYSQL update statements failing

I have been coding php for years, but today I have encountered a problem I have never seen before. Some very simple update statements are failing -- or rather instead of updating, they are replacing ...
user87842's user avatar
0 votes
0 answers
114 views

Update woocommerce order item custom meta field

I am trying to add a simple input field to the order backend and use it to update my order item information. It's a simple meta called "Number of People". It seems like everything is working ...
Edson Luiz's user avatar
1 vote
1 answer
139 views

Unable to successfully initiate scanning using exec(), shell_exec(), or system()

I've been trying for a few weeks now to fire a batch file that runs the command to scan a document from a scanner attached to the same machine. I'm working on a web app that (using PHP) is meant to ...
Christopher Robinson's user avatar
0 votes
3 answers
157 views

Post request body empty - XMLHttpRequest to PHP [duplicate]

Always getting empty post data null in php end var data = new FormData(); data.append('ip', 'val'); data.append('ua', 'val2'); data.append('country', 'val3'); var xhr = new XMLHttpRequest(); xhr.open(...
EliteX's user avatar
  • 125
0 votes
1 answer
95 views

No Data or Errors from Server Sent Events

I'm new to server sent events and I'm trying the MSDN laid-out method of going about server sent events; with no luck. No errors and no data seem to be received by my small HTML file's embedded ...
Austin Jones's user avatar
1 vote
1 answer
87 views

Customed shortcode shows same value to the whole post query loop (WordPress Archive page)

I created a shortcode using the code below and placed the shortcode in the post query loop, e.g. archive page. At the result, all the items in the query loop show 'bread' regardless to what category ...
FUFY's user avatar
  • 19
0 votes
1 answer
93 views

Replacing "Read more" text on the buttons of post query loop (WordPress archive page)

I tried to replace "Read more" text on the buttons at the end of each post in the post query loop, e.g. archive page, using 3 versions of codes below. None of them worked, the text still ...
FUFY's user avatar
  • 19
1 vote
1 answer
43 views

Twilio WhatsApp Sandbox: "Twilio could not find a Channel with the specified from address" when sending from PHP (twilio/sdk 8.x)

I'm trying to send a WhatsApp message via Twilio WhatsApp Sandbox from a PHP app. The recipient has joined the sandbox and appears under Sandbox Participants use Twilio\Rest\Client; $client = new ...
Anees Ali's user avatar
0 votes
1 answer
115 views

Sorting completed date in WooCommerce order list (admin dashboard)

I added a new column of completed date in the woocommerce order list page using the code here. The new column shows sorting buttons (up/down arrows) properly but when clicked, seems like it sorts on ...
FUFY's user avatar
  • 19
0 votes
0 answers
33 views

How to conditionally prefix routes based on user's currency in a web application? [duplicate]

I'm working on a routing system where I need to conditionally prefix all existing routes based on the user's currency. The logic should follow these rules: If the user's currency is INR, prefix all ...
Srinivas V's user avatar
5 votes
3 answers
424 views

No rule to make target '/opt/homebrew/Cellar/openssl@3/3.4.1/include/openssl/opensslv.h' installing php 8.4.11

Sat 29 Nov 2025 Per @kakaiikaka's request: $ /opt/homebrew/Cellar/openssl@3/3.6.0/bin/openssl version OpenSSL 3.6.0 1 Oct 2025 (Library: OpenSSL 3.6.0 1 Oct 2025) $ which openssl /opt/homebrew/bin//...
P. James Norris's user avatar
2 votes
1 answer
109 views

Custom File upload Component in Livewire Laravel

I am trying to create a reusable Livewire input-file component, Such that : Easy embed in any (parent) and pass the model name (ex = "file1") How to store() the file is in control of (...
Dr.coddy hanseling's user avatar
0 votes
1 answer
80 views

WalletPass Notification API Returns 200 but No Push Notification Received

Problem: When using the WalletPass Notification API to push updates to a pass, the API returns a 200 OK response, indicating success. However, no push notification is actually delivered to the ...
Saif Hesham's user avatar
0 votes
0 answers
96 views

How do I convert from an object cast, to a string? [duplicate]

I can cast from a string to an object type, but I can't find a way to cast an object (that I know is a string) back to a string. Is this possible? See very simple example: <?php $myStr = "abc&...
ShhTot's user avatar
  • 80
1 vote
1 answer
87 views

PhpWord generates paragraph breaks in addhtml

I am using PHPWord from within PHP to generate a word docment. I do use addHtml to transform some Mysql text containing multiple lines into a Word paragraph. My input text contains: <pre> Lorem ...
OfiserChris's user avatar
0 votes
1 answer
84 views

What is the correct context to consume a RabbitMQ broker within the PHP/laravel ecosystem?

We have a system that captures telemetry data in real time. The broker we hire sends telemetry data in real time from the device they place inside our cars. This operation has been running for two ...
laravel_'s user avatar
0 votes
1 answer
128 views

How to change model to export from filament resource to exporter class

I have an application that uses filament 3.2 and in this application I have a resource called "Students", within this resource I am calling a "Tables\Actions\ExportBulkAction" that ...
juan's user avatar
  • 13
1 vote
1 answer
62 views

PHP LDAP sessions (how to preserve password for subsequent bind calls)

I'm struggling to figure out how to add ldap authentication to a webapp that I am writing to manage entries in the LDAP server itself. I want users to be able to log into the webapp with their LDAP ...
Mose's user avatar
  • 607
1 vote
0 answers
85 views

PhpWord and \n in line together with HTML code

Using PhpWord in my PHP project gives me issues. I do have a variable containing CR/LF (\n) and HTML code. Something like: $str='<div style="font-style: italic; text-align:center">...
OfiserChris's user avatar
0 votes
0 answers
68 views

How to handle PayPal subscription plan changes in Laravel when update/revise requires user approval?

I’m building a Laravel application that uses PayPal subscriptions. My app’s database and PayPal subscriptions are kept in sync, and users can manage their subscription from a dashboard. When a user ...
Obsidia's user avatar
  • 108
0 votes
0 answers
74 views

Error `invalid_grant` when trying to obtain a refresh_token from Google

I want to connect Google Business reviews. I have created a web application and have a client ID and client secret. The following APIs are connected: Analytics Hub API Anthos Service Mesh Certificate ...
Ігор Тригук's user avatar
0 votes
0 answers
107 views

What credentials do I need for Google reCAPTCHA Enterprise?

I'm using Google reCAPTCHA Enterprise, and I'm on the stage of creating an "assessment" in my server side code (PHP). I'm following the example code from the docs but I get an error: "...
DisgruntledGoat's user avatar
0 votes
0 answers
60 views

How to mock usager of Laravel scopes for unit testing?

I'm using Laravel 12 along with Pest (using Mockery), and I have this method : public function destroy(array $ids): array { $data= Item::findAllByFieldIn('id', $ids)->get(); // ...
naspy971's user avatar
  • 1,411
1 vote
1 answer
73 views

No results in meta_query by custom field

The problem is that I'm trying to use meta_query to filter posts by ACF fileds values 'year_start' and 'year_end'. Each of those fields take taxonomy called 'archive_year' and I am trying to make the ...
Griox Angle's user avatar
2 votes
0 answers
87 views

Join API endpoints and write out result

I would like to join endpoints and return result (in Wordpress). After I get the results, I want to import with WP All Import plugin, Hotels and Locations. I'm using Traveler theme. The API is: https:/...
Steve Miller's user avatar
0 votes
1 answer
70 views

Getting WooCommerce "View Product" Link To Appear Everywhere

I have this code that I have added to WP site using the Snippets plugin. The code is intended to display a "View Product" link in addition to the "Add to Cart" button for ...
Delinx's user avatar
  • 55