Skip to main content
The 2024 Developer Survey results are live! See the results

PHP Collective

Questions

Browse questions with relevant PHP tags

1,467,499 questions

0 votes
0 answers
5 views

React app is giving me CORS policy error. How can I fix it?

Problem: I'm trying to make a login page in React using Vite. To verify login credentials I have created an API in PHP. When I test the API with Postman it returns a data but with my react application ...
Muhammad Ahmad Chattha's user avatar
0 votes
0 answers
16 views

Easy way to autonomous periodic data update in Laravel, PHP

How can I autonomous calculate and update value for one column in my Laravel project? I have no much experience in web-dev, so I just dont how to do it effective. For example, now I've column "...
dekma_d's user avatar
0 votes
0 answers
9 views

Laravel MongoDb Aggregation For unique and null

I want to retrieve documents from mongoDb by using MongoClient for parent_id is only first of same and parent_id is null.Only one aggregation. $search[] = [ '$group' => [ ...
Wai Yan's user avatar
  • 21
-2 votes
0 answers
16 views

PHPUnit 'Error : Class "path\to\class\classToTest" not found'

I'm trying to write some unit tests. However no matter what I do I keep getting this error: Error : Class "path\to\class\classToTest" not found The test I'm trying to run has a simple ...
bencher's user avatar
  • 17
-1 votes
0 answers
16 views

Using Puphpeteer to scrape web page with no classes or ids [duplicate]

I'm helping a friend to migrate their blog from a "homemade" platform to Wordpress and the original developers have not been helpful in extracting the content so I'm trying to figure out how ...
Sanfly's user avatar
  • 1,019
-3 votes
0 answers
24 views

Get sum of values in multi array [duplicate]

I have an array with different keys, and I am interested in the sum of the values of only the ones that start (or contain) "MT". $json = file_get_contents($path2); //echo $json.'<br&...
Amphata's user avatar
  • 27
-3 votes
0 answers
25 views

how can i correctly return array value to jquery [closed]

<?php include ('config/dbcon.php'); if (isset($_GET['visa-id'])) { $visa_id = $_GET['visa-id']; $query = "SELECT document, preference FROM visa_document WHERE visa-id = '$visa-id'&...
Hissan Zahir's user avatar
-5 votes
0 answers
16 views

Wordpress redirecting me to the homepage only, can't edit anything [closed]

Here is the video showing the exact problem i'm having, Wherever I click in the wordpress website on any page any setting it always redirect me to the Homepage only, I tried few solutions like -...
Praveen Kumar's user avatar
0 votes
0 answers
11 views

woocommerce_before_calculate_totals doesnot update mini cart [duplicate]

I want to add specifics products in the cart if certain conditions matches. E.g for upto 100 a specific product is added with the price 0 and from 101 to 200 another products are added. I was able to ...
Saugat Karki's user avatar
1 vote
0 answers
38 views

How to modify a PHP class to accept PgSql\Result as an attribute

I need to find a way (if possible) to make a PHP class accept a PgSql\Result object as an attribute. PHP 8.1+ has migrated the pgsql result resource to the PgSQL\Result instance. In prior versions ...
Steady Eddie's user avatar
0 votes
1 answer
29 views

Problems with LVE ID 5487

I made a php application that uses the spatie library top convert pdf files to jpg, using ghost script and imagickMagic. The process is slow, but in dev enviroment, it works fine. I just ajusted the ...
Roberto Carreira's user avatar
-1 votes
0 answers
35 views

Session variable into a prepared statement [closed]

When I submit a form, I would like the Session variable user_id to carry through to my prepared statements so it can be inserted into my table. Code <?php if($_SERVER["REQUEST_METHOD"...
Matt Drake's user avatar
-1 votes
0 answers
15 views

Cannot connect to Postgres from my php/symfony application

I'm having issues connecting to any database from my php/symfony application when I try to connect to pg_connect("host=localhost port=5432 dbname=dbname user=username"); the app just dies ...
Dhee4's user avatar
  • 1
0 votes
0 answers
20 views

Live reload server (Gulp + BrowserSync) for php files doesn't work inside docker container

I have a fully functioning live reload server for my php projects using Gulp and BrowserSync: gulpfile.js const { watch, series } = require('gulp'); const browserSync = require('browser-sync'); const ...
GhostOrder's user avatar
0 votes
0 answers
16 views

Google PlayIntegrity API validate token via PHP

I try to get device verdict with google play integrity token, but always have a million errors and I can't understand whats wrong. My Code: <?php use Google\Client; use Google\Service\...
Arkadiy Kryzhanivskyi's user avatar
0 votes
0 answers
22 views

Json error: Cannot modify header information – headers already sent on Aws-bitnami

Inquiries regarding logs in the following format are probably the most common due to json errors related to WordPress. [Thu Jul 25 13:00:50.367263 2024] [proxy_fcgi:error] [pid 26574:tid ...
Young Lee's user avatar
0 votes
0 answers
30 views

PHP not connect to Microsoft Fabric database

I am attempting to connect to a database on Microsoft Fabric, but it will not connect. It does not display any error messages, nor is there anything in the logs. I am at a loss for what the issue ...
Tony's user avatar
  • 1
0 votes
0 answers
16 views

filtered special Database statements for google index

I have the url() statement in my database. all in www.site.com/random_alias format (splash pages). Some links were created by the admin (userid=1) and archived to specialized (archived=1). how can I ...
Ali Haseli's user avatar
0 votes
0 answers
15 views

Imagick creating PDF even though setImageFormat is set to JPEG

I have an odd issue that I cannot get to the bottom of. I'm using Imagick to generate JPG thumbnails of PDFs that are uploaded to a custom admin tool. However, Imagick is creating PDF files even ...
awvickers's user avatar
0 votes
0 answers
16 views

Why is Google Sheets PHP API failing when I insert a line manually in Google Sheets?

I have a PHP script adding lines to a Google Spreadsheet. It all works perfectly fine. $client = new Google_Client(); $client->setApplicationName("Google Sheets API"); $client->...
Matthias's user avatar
-1 votes
0 answers
18 views

php8.1 - Deprecated code involving date_create() [duplicate]

Here are the errors I am getting: Warning : Undefined variable $modified in /home/cssdar/public_html/members/templates/cassiopeia_members2024/index.php on line 38 Warning : Undefined variable $...
Karen Kurtz's user avatar
1 vote
0 answers
13 views

Understanding uriTemplate and Variable IDs in Symfony API Platform

I'm currently working on a Symfony project using API Platform, and I'm running into some confusion regarding the uriTemplate system and how it handles variable IDs. I have an entity called Article, ...
GeppettoG's user avatar
0 votes
2 answers
50 views

Get model relationship collection from another database in Laravel

I have set the connection to two databases properly. I also have created eloquent table models and I can query a single table relationship from another database easily e.g. $user->customer User ...
Drunken M's user avatar
  • 2,474
0 votes
1 answer
34 views

Detecting OR operator sequences and wrapping their content in a parenthesis when building a query with PHP

I made the following PHP code to build a query based on user input, where they can choose the condition and the operator and the resulting query would be printed on their screen every time they added ...
Victor Canela's user avatar
0 votes
0 answers
22 views

Error when submitting to Database: No data supplied for parameters in prepared statement [closed]

I'm building a webform that a User would fill out and then submit, adding their details into a table called atyzi_wctc in the Database. The Database is making the connection, but it keeps responding ...
user3426808's user avatar
0 votes
0 answers
18 views

php file not found when path contains spaces using fastcgi unix socket

I am transferring a site that was built on windows xampp to a server running ubuntu 24.04, apache 2.4.62, and php 7.4.33. Everything is working fine except php files containing spaces anywhere in the ...
Colt's user avatar
  • 1
-2 votes
0 answers
24 views

MacBook remote database access works with Sequel Ace and MySQL Workbench but not php (not a duplicate) [duplicate]

My remote database access works with Sequel Ace and MySQL Workbench but not php My connection script contains the exact same data. I've searched everywhere for a solution. Any idea why? Thanks. Robert ...
Robert's user avatar
  • 1
-2 votes
0 answers
29 views

I'm using the PHP Server extension in Visual Studio Code and received a message

Hi I have created a website with .php format and I need help to run these PHP files on VS code, here is the massage that shows "From v3.0.0 onwards, PHP server will open the server URL in your ...
Shadman Sammy's user avatar
-2 votes
0 answers
26 views

Mapbox display pins from point A to point B [closed]

I have a mapbox with multiple pins. How can i display only pins from specific A point to specific B point within a radius of 10 km? Specific points will be typed by the user from two text inputs (A ...
Catalin Iamandei's user avatar
-2 votes
1 answer
24 views

Limit the number of characters / words in WooCommerce product backend [closed]

When we create a product in WooCommerce, I want to : limit the product title to 30 characters limit the product short description to 50 words I found many shortcodes that limits that in the frontend,...
Jeriss Cloud Center's user avatar
0 votes
0 answers
8 views

GraphQL nested objects query returns internal server error

I am learning GraphQL server with PHP, MySQL and I have following problems with nested objects. This is my ProductType.php: <?php namespace App\Types; use GraphQL\Type\Definition\Type; use ...
Nick Helper's user avatar
0 votes
0 answers
20 views

Remove backslash from escaped forward slash in a string

I have an array(imageURLS) of string in js. Used 'fetch' to send the array as JSON.stringify(imageURLS) to savedesign.php. The array elements are like ['shop/2.png' , 'shop/3.png']. But each elements ...
zaman's user avatar
  • 29
0 votes
0 answers
17 views

File Size & Resume Option is Not Showing While Downloading File with HTTP Header

I've written a code in php, which is used in downloading link like https://example.com/dl.php&file=test.zip. Here the file dl.php checks the HTTP refer, if it is allowed then it download the file ...
Ahtsham Khan Qazi's user avatar
1 vote
0 answers
15 views

Using Laravel Reverb with Laravel and Nuxt and multiple apps/layers

I have a weird issue. I am using Laravel Herd Pro locally for development and I added a Laravel Reverb Server using the Services in Herd. I got these credentials: REVERB_APP_ID=1001 REVERB_APP_KEY=...
Torben's user avatar
  • 5,454
1 vote
0 answers
18 views

prevent change quantities on cart page

I'm using combo offer woocommerce plugin to make a bundle product with specific item number of linked products. I had unchecked this option: "Buyer can change the quantity of combo products?"...
engnajjar 's user avatar
1 vote
0 answers
34 views

PHP - Issue when adding a return type declaration for a parent class [closed]

I have currently have the following classes: class Textarea Extends Field {} class Field {} I'm trying to declare a return type for the following function public function field(string $field): Field ...
Jackatron's user avatar
0 votes
0 answers
25 views

How to view images and sentences like "With text wrapping -Square" of Word - laravel-dompdf

I'm using laravel-dompdf now for printing pdf. PDF format: Two images are displayed on the right half of the first page. The sentence is displayed as much as possible in the left half of the first ...
bluestar0505's user avatar
0 votes
1 answer
32 views

Eloquent ORM performance with subqueries for relational models

Laravel eloquent uses subqueries for relationship model instead of joins as joins offer more optimal performance .How does eloquent orm ensures performance for relational models ?
Rubin Porwal's user avatar
  • 3,805
-4 votes
0 answers
24 views

I am having a problem removing a google mark from my website [closed]

I am having a problem because my website is showing a google mark on the right hand side. I want to remove it. But I don't how to do this. The website name is https://mozodeals.com/. I have deleted ...
Amit Goyal's user avatar
1 vote
1 answer
12 views

Custom Low Stock availability string for WooCommerce product variations backorders allowed

I'm looking to edit the woocommerce low stock message. But only for product variations which are set to allow backorders. The message should include the stock level, and only appear when the stock ...
Jeff's user avatar
  • 11
0 votes
0 answers
19 views

Problem with ACF Date Range and Repeater Integration in WooCommerce

I am using ACF to create fields integrated with WooCommerce. I am struggling to manage the tour status for each period in the Week Days mode: The tour has 2 modes: Week Days and Exact Dates. A tour ...
Ridwan's user avatar
  • 1
0 votes
0 answers
26 views

Microsoft Graph API Authorization Error: 'Invalid size of Code_Challenge parameter.'

I am trying to generate an access token via a PKCE flow to call the Microsoft Graph API. I am following this msdoc : Microsoft identity platform and OAuth 2.0 authorization code flow - Microsoft Entra ...
sko's user avatar
  • 1
0 votes
0 answers
15 views

How to change "ownerRecord" in RelationManager in Filament 3?

It is a basic RelationManager example of PostResource: public static function getRelations(): array { return [ MediaRelationManager::make() ]; } $post->media() (morphMany). ...
Marjwl's user avatar
  • 1
-2 votes
0 answers
24 views

React Expo push notification, sending notification to required channelId from PHP

https://exp.host/--/api/v2/push/send { "to": "ExponentPushToken[***************]", "title": "Test Notification", "body": "This is a test message.&...
Tejas Rao's user avatar
1 vote
0 answers
57 views

Accented chars in dates

I've a problem in formatting dates in it_IT locale. I've a customer with a site running on PHP 8.0.3, and due to some certification issues (this customer has to mantain ISO27001 certification) I've ...
Rodolfo's user avatar
  • 51
0 votes
1 answer
50 views

Upgrading PHP to 8.3.9 from 8.2.12 on Windows 11 - cURL is not working [closed]

Steps I am taking: Fresh install of XAMPP, which uses PHP 8.2.12. After install, I confirm that cURL shows enabled in my phpinfo and my local coding files work as expected. I renamed the existing php ...
Schweino's user avatar
0 votes
1 answer
28 views

AlpineJS submit a form without refreshing the page

I am working with Hyva theme with AlpineJs on Magento and using a <form> with the needed inputs to add a product to the shopping cart. This is part of the form code: <form method="...
Nicky Ichov's user avatar
0 votes
0 answers
46 views

Problem while trying to run composer update

I'm currently working on the dockerized version of ProcessMaker 4.1.21 and I'm encountering the following error when I try to run the "composer update --ignore-platform-reqs" command : PHP ...
Incognito's user avatar
1 vote
0 answers
19 views

Watermark for custom image size in WordPress

I use a watermark code for a WordPress theme. The code works fine, but it generates a watermark for every uploaded image. How can I modify my code to not watermark some image sizes? I have an image ...
Pityer's user avatar
  • 135
0 votes
1 answer
27 views

Can i login using only pin in Auth::attempt

i tried this to login but it failed to login in system if (Auth::attempt(['mpin' => $otp])) { $check_otp->update(['otp' => '']); session()->put('is_login', true); session()-&...
MDSolanki's user avatar


15 30 50 per page
1
2 3 4 5
29350