Questions tagged [php]
PHP is an open-source, multi-paradigm, dynamically-typed, and interpreted scripting language designed initially for server-side web development. Use this tag for questions about programming in the PHP language.
1,463,227
questions
0
votes
0
answers
10
views
can't make the migration
Launched the Laravel + Laravel Telegraph startup project. According to the instructions, I successfully executed the following commands:
composer require defstudio/telegraph
php artisan ...
0
votes
1
answer
54
views
Laravel App on Google App Engine Hangs with Responses Larger Than 450KB
I am facing a perplexing issue with my Laravel application hosted on Google App Engine (GAE)Standard ENV. While the application runs flawlessly in a local environment, I encounter a specific problem ...
0
votes
0
answers
8
views
$_SESSION returns NULL although it's properly stored
I've searched for several hours now and can't solve this anyhow - I always see that you need to put session_start() on top of the .php file without any empty space but that's it.
So this is the ...
0
votes
1
answer
15
views
PHP version in webserver is different to PHP version in terminal
I'm using valet and have just created a fresh Laravel 10 project. One of my other projects requires PHP 7.3, so I switch between this and other versions using valet use [email protected]. For my new project, I ...
-1
votes
0
answers
20
views
Time in and Time out logic for each Employees in PHP
Hello I am making an employee attendance management system for it I have login system which consist of two interface one is for admin another for employee. In employee interface I have added Time in ...
0
votes
0
answers
8
views
Fail to make php curl call to local application inside docker container (Error occured while trying to proxy to)
First of all I am pretty new to docker and nodejs so please bear with me if I say stupid things.
I have an instance of a nodejs application which runs inside a docker container (https://github.com/...
0
votes
1
answer
180
views
Laravel Livewire Component Not Rendering View Content
I am working on a Laravel project using Livewire and I've encountered an issue where my Livewire component's view is not rendering any content on the page. When navigating to the route associated with ...
10
votes
4
answers
3k
views
Laravel add where clause to union result
I'm doing a union on two queries, and I want to add a where clause to the result, but the where clause is added only to the first query. how can I fix that?
$notifications = DB::table('...
0
votes
0
answers
7
views
Is it possible to unit test php files that are linked to MySQL and coded procedurally
I have to do a unit test, but the code I received is a php file linked to MySQL. The problem is that this file is not divided into class or function, but just a huge if~else statement. There are no ...
0
votes
0
answers
11
views
Prestashop 1.7.7.3 and PHP 7.4 issues
I haven't really used my website in quite a while due to it giving me errors on use and I didn't have the time to review the issue. I am currently trying to get it to work and I am struggling to get ...
0
votes
0
answers
14
views
Use of collect for large data volumes
I have an application developed with Laravel that, in several sections, needs to process large volumes of information. Recently, I've been getting alerts about high CPU usage on the server. I wonder ...
0
votes
1
answer
74
views
What is the issue with my code to upload image in the users form?
I'm working on a MySQL and PHP project where I've created a form to capture user details, including their passport. However, when users fill out the form and click submit, the page goes blank, and the ...
0
votes
1
answer
49
views
How to send the selected option from mysql to another page using ajax
this is my code.
'tv_s<!DOCTYPE html>
<html lang="en">
<head>
<title>Uploading video with a progress bar</title>
<meta http-equiv="Content-Type&...
0
votes
2
answers
20
views
Get files from directory folder and append to select dropdown (options) - Wordpress / WC
I' am trying to get a list of file names from a directory folder and append them to an existing select dropdown filed as options.
add_action ('wp_head', 'testf');
function testf() {
$customer = ...
0
votes
0
answers
10
views
My autocomplete only displays the last entry in my json array
I am not familiar with Jquery or JSON so I was happy I got this far with trying to build and auto complete search but in my search suggestions box only the last entry in the JSON response comes up.
...
1
vote
1
answer
41
views
Laravel 7 - Prevent eloquent relation from query DB if null
I have read similiar topics such as:
Laravel Eloquent - Do not run relationship query if column value is NULL or 0 and
Laravel relationships avoid query where foreign key is null
https://github.com/...
0
votes
0
answers
25
views
Apache redirect and PHP header
I'm trying to create my own MVC structure in PHP, and I'm stuck on a conflict with an Apache rewrite rule and the PHP header() function. All requests are redirected to public/index.php file and in ...
7
votes
6
answers
21k
views
SQLSTATE[HY000] [1049] Unknown database 'laravel'
I am getting this error while trying to save an object into DB.
SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: insert into cards (card_price, active, updated_at, created_at) values (0, 1, ...
0
votes
0
answers
25
views
Send a quick response to a server and then process code
The context is as follows, I have a relatively large code inside a webhook, I receive data from a server and need to process it. The problem is that this processing takes time due to some complex SQL, ...
0
votes
0
answers
30
views
my code is echoing the variable on same page of my webserver . Want the echo to be on next page without adding extra php
I am new to PHP and html .
My Php file
<?php
include 'tele.html';
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
...
0
votes
0
answers
26
views
How to make a TravelPayouts flight Search API request? [closed]
I follow the following instructions to make API request with TravelPayouts flight search API and these instructions to create the signature https://support.travelpayouts.com/hc/en-us/articles/...
0
votes
1
answer
19
views
Change laravel morpth migration field to nullable
I want to change morph field that already exists to nullable in laravel.
public function up()
{
Schema::table('table', function (Blueprint $table) {
$table->nullableMorphs('cartable')-&...
-1
votes
1
answer
24
views
Issue with Rendering Base64 Image from POST Request in TCPDF
I have a base64-encoded image:
var croppedMap = croppedCanvas.toDataURL('image/png');
var form = document.createElement('form');
form.setAttribute('method', 'post');
...
0
votes
0
answers
5
views
PHPUnit Cannot stub or mock class or interface "resource" which does not exist
I am trying to mock or stub a "resource" type. This code confirms that PHPUnit can use the "resource" type, but it throws an error when I try to mock it. Error: Cannot stub or mock ...
0
votes
1
answer
68
views
Search query works in local and some filters does not work in production for Laravel
I have a query script for Laravel that does multiple search filtering algorithm. The search filters all work perfectly on local, but on production, when a keyword is entered, it correctly checks for ...
0
votes
1
answer
40
views
Complex (curly) syntax: ${var} or {$var}
I've read several posts, also here on Stackoverflow, but I can't really understand the difference between putting the $ sign inside or outside the curly braces.
$animal = "cat";
echo "I ...
-1
votes
1
answer
28
views
PHP create a CSV file with Windows-1252 encoding
I want to generate and save a CSV file with "Windows-1252" encoding.
My base code :
$filename = 'path/to/file.csv';
$file = fopen($filename, 'w');
$datas[] = [
"data 1",
&...
-3
votes
0
answers
19
views
wordpress admin panel works unfunctionally [closed]
I'm a developer, I'm using the wordpress Admin Panel, it's not related to my code. When I click the edit page as shown in the pic, it redirects to the dashboard page automatically.But sometimes it ...
0
votes
0
answers
35
views
async wordpress thumbnails generations only after save post
I have a wordpress site with woocommerce, each product has many images (10-15) and each original image is 1-2 MB. these dimensions are necessary for the purposes of the sector of this site.
Every time ...
-1
votes
0
answers
22
views
Dynamic Display of Product Content in WooCommerce Product Description
I am facing an issue with dynamically displaying the colors variations of a product and his price in a product bloc description. I want to automatically show the available color variations for each ...
0
votes
1
answer
138
views
How do I prevent the default submission of forms loaded via Ajax in this Laravel 8 app?
I have made a blogging application in Laravel 8. I am currently working on adding comment replies via jQuery (v3.5.0) AJAX.
In comment-form.blade.php I have:
<div class="form-wrapper">
...
-1
votes
0
answers
23
views
Set time to show abort(500, "...") notification in php8x, laravel [closed]
Whenever I abort a snippet or code, there's a notification shown to the user in the platform, that indicates what the error could be. In this case I'm printing a long message so the time is not enough ...
0
votes
1
answer
23
views
Slow loading of large php files on PHP 8.2 gloogle cloud engine
We're using cache files that consist of a combination of simple PHP code and HTML. These cache files are stored with a PHP filename.
Some files exceed 400 KB, and I've noticed that Google App Engine, ...
-1
votes
1
answer
20
views
How to compare passwords and usernames entered by users against the stored passwords and usernames [closed]
How to compare passwords and usernames entered by users against the stored passwords and usernames using PHP
Have tried using control structures but didn't go well as per my expectations..the ...
2
votes
6
answers
14k
views
How to refresh a PHP Page without reload
I have a PHP page called js.php and i want to refresh the page without reloading the entire page. I know this question has been asked too many times but I just cant understand it. I tried the code ...
-2
votes
1
answer
34
views
How to send html email with hyperlink variable as the url
I have a webform that passes variables $link1 and $link2. I would like to include these variable in an html email send. Links come up empty in the email. Thank you
// send form2 results through email
...
0
votes
0
answers
14
views
Upgrading PHP version in Matomo on Ubuntu server
I have Matomo installed on my server using [email protected].
In order to remove the warning showing in Matomo dashboard I want to upgrade to php8.2 only on Matomo directory, without affecting the system.
I ...
161
votes
7
answers
120k
views
How do I install Composer PHP packages without Composer?
I'm trying to install the Coinbase PHP API but it requires Composer:
https://github.com/coinbase/coinbase-php
I'm looking for a universal PHP solution (perhaps a function) to let me install composer ...
0
votes
0
answers
25
views
Could not resolve host from Curl PHP but not from Postman. Why? [closed]
I send a PHP Curl request and get the message: Could not resolve host.
The only thing from all of the variety answers that could help me is writing "IP => host" into the /etc/hosts (...
0
votes
0
answers
19
views
Difficulty with Printing to Magento 2 Error Log
I am trying to print messages to a Magento 2 error log so I can debug a module. I am new to Magento 2 core programming, and I haven't been able to get messages to print to error logs. I am trying to ...
0
votes
2
answers
122
views
WPCARGO ERROR Fatal error: Uncaught Picqer
Fatal error: Uncaught Picqer\Barcode\Exceptions\BarcodeException: Neither gd-lib or imagick are installed! in C:\xampp\htdocs\wordpress\wp-content\plugins\wpcargo\lib\barcode-generator\vendor\picqer\...
2
votes
3
answers
731
views
Stripe API and PHP: Relationship of PAYOUTS to Payment Intent / Charges
I'm new with STRIPE, and I've been reading the documentation for STRIPE, and was task to create a list of payouts to a connected account (type is standard). Also, I have to show the details, under ...
0
votes
1
answer
70
views
JQuery AJAX request stuck pending indefinetely
I am trying to use jQuery.ajax({}) to run a PHP file. All my ajax requests will not execute and just remain pending forever.
I have looked at many different solutions but none have worked.
let ...
0
votes
1
answer
42
views
I am using ISP Config host, I just updated shopware 6.4.20 to 6.5.6 and dependencies require a PHP version ">= 8.1.0"
I am using ISP Config host, I just updated Shopware 6.4.20 to 6.5.6, for which I had to change PHP version so I changed it from host settings and it was shown in admin that its updated , but now bin/...
0
votes
1
answer
35
views
PHP8: Increasing unset indexes elegantly and fast
PHP8 triggers a warning if an index in not set.
In PHP7 the following (very simplified) snippet used to be a 'dirty' but a very readable and working solution to count stuff according to their key on ...
0
votes
1
answer
17
views
Hide custom DIV CSS on product listings to a single product in WordPress
I have resolve it.
<div class="EMP-100-TAW-Craciun-Produs-I">
<?php
if ( get_the_ID() === 1744) { $product;
$regular_price = esc_attr( $...
0
votes
0
answers
36
views
Laravel auto-injection issue (Too few arguments) after migrating to PHP 8.2
I recently migrated my Laravel project to PHP 8.1, and I'm encountering an issue with dependency injection in my controllers. I have set up auto-injection in my AppServiceProvider using the bind ...
0
votes
2
answers
41
views
Issue with mb_internal_encoding() function in PHP 8.3 when using Command Line Interface (CLI) - No problem in PHP 8.2
I'm working with PHP 8.3 and have encountered a puzzling issue regarding the mb_internal_encoding() function. When using PHP through an Apache web server, everything works seamlessly. However, when I ...
-2
votes
0
answers
33
views
Can't get through a HTTP 500 [closed]
I am doing a docker Setup with two nginx configs
One of them is running locally (Ubuntu), without any problem
But on remote (Ubuntu) it is not working.
My Compose File
nginx_be:
container_name: bx-...
0
votes
0
answers
9
views
Add a button to the admin view of a woocommerce product that links to a custom webhook with the product ID appended to the end
I have a woocommerce store and I have created a function in functions.php to include a button to the simple-product page if you are signed in as an administrator. This function works great and the ...