Collect all kinds of php programming exceptions and fault solutions.

PHP add 24 hours to a specific date

I need to add 24 hours to a date that will be stored in a variable.
$date = "2019-11-20 05:05:00"; => $date = "2019-11-21 05:05:00"; (24 hours have been added).
I've tried some optio...

Can't make "composer require laravel/ui --dev" on laravel 6.5.1

I am getting following error :
Can't make "composer require laravel/ui --dev" on laravel 6.5.1. I get an error
"Your requirements could not be resolved to an installable set of packages.

How to set release limit while using php-deployer?

I am using PHP deployer 6.6.0 to deploy Laravel based websites.
Every time I deploy it creates a new release. Currently, I have more than 10 releases and it's eating up a lot of disk space.
I don't...

How can I downgrade or use PHP 7.2 without uninstalling PHP 7.4? Is it possible to use PHP 7.2 as default instead of the latest version?

I am using linux Ubuntu 18.04
And I wanna revert back to the previous version of PHP.
I've seen tutorials that requires me to uninstall the latest version, now I am asking if there is a workaroun...

WordPress Rest API Response Count

I have WordPress Rest API used to retrieve all the users.
my Wordpress site contains more than 10 users. But here response cont...

Retrieving data from polar accesslink via php sdk

I am attempting to use the polar php sdk to retrieve data from the polar accesslink api. I am able to get through the Oauth2 workflow but am stuck after receiving the access token. Following the

Stacking Multiple Ternary Operators in PHP

This is what I wrote :
$Myprovince = (
($province == 6) ? "city-1" :
($province == 7) ? "city-2" :
($province == 8) ? "city-3" :
($province == 30) ? "city-4" : "out of borders"
But for every ...

how crudbooster get the table fields of specified table and how detect which table it is?

I'm using crudbooster from crocodic-studio and it was reading code to learn in deeper the app and add more functionality, but I understand this function that gets all columns from the specified tab...

Is there any drawback of laragon compared to xampp?

I was having trouble while installing xampp in my pc. And then i found laragon easy to install and quite simpler as well as user friendly compared to xampp. But why xampp is so popular among the dev

Symfony 3.4 - switch to dynamic database from command

Recently I've been busy upgrading an older project from Symfony 2.7 to 3.4. The project uses a custom multi tenant setup and relies on a EventListener to switch between databases based on subdomain...

WordPress using PHP7.3 in public_html, but MySQL extension error only showing in the dashboard

I recently upgraded from PHP 7.1 to 7.3. The .htaccess files in public_html, wp_content, and wp_includes all show:
AddHandler application/x-httpd-ea-php73 .php .php5 .phtml
<IfModule mod_suphp.c...

How to upload large files to Amazon S3 from Laravel?

I want users to upload large files (like HD videos and big PDFs) and am using this line of code to upload the files. Storage::disk('s3')->putFile('uploads', new File($request->file('file_uplo...

Symfony: send failed messages via email

I have a simple messanger config:
failure_transport: failed

Secure connection to error on GCloud VM with CentOS (LAMP)

I have this well known problem about a recently installed that has an error on any part that tries to connect to the servers (updating, installing plugins, insalling the...

How to move html/css content to a different column

Right now I have this program that echoes out an image and a text ten times. It does so all in one column. I want to make it so that it fills up one whole page by going horizontally after it hits t...

Symfony 5.1.2 page not found with new project

I created a new project using Symfony 5.1.2, then I tried to run the server using
symfony serve. Once I tried to access localhost:8000, I had this warning in the terminal : [Web Server/PHP ] Jun 22...

How to translate emails when sending them asynchronously with Symfony Messenger?

I configured the Symfony mailer to send emails with messenger.
I have my emails in two languages and I rely on the requests to det...

Convert html with styling (css) to pdf using PHP

I'm having some problems with my code! I am trying to convert my html invoice to a pdf invoice. After a payment is made the invoice is generated by the code below. Then the pdf file gets stored on ...

React + Laravel 7 API - CORS issue

I'm trying to do a simple Sign Up form (just studying) and i'm having a problem with CORS. I've tried everything that I have found but none worked. From what I learned, Laravel 7 already works to p...

How to get NULL by default in MySQL

I am writing this condition to get the count of Null Values in MySql
$total_fads_count = mysqli_query($con, "SELECT * FROM user_boat WHERE user_id='$user_id' && ad_status='

Amphp : Run many async loops with same connection (eventstore client)

I'm using eventstore client which uses amphp. I need inside my application to reuse the connection in many parts.
So I created a connection provider:
public function getConnection(): EventStoreConn...

Error in Wordpress - elementor after ugrading PHP 7.4

After upgrading to PHP 7.4, elemntor started giving error
Cloud Service: GCP
Server: Openlitespeed Wordpress
Linux: Ubuntu 20.04 LTS
Notice: Trying to access array offset on val...

modules and language in codeigniter 4

let assume that the structure of the files as the following
..... until
Admin (inside Admin folder will be controllers and views model config and language)

Greying out "out-of-stock" product variations with custom stock quantity reduction in WooCommerce

I've used the awesome snippet of to add an additional setting to variations that reduces the main inventory stock by the set amount in the

Laravel Lighthouse GraphQL unit tests: "Variable not defined"

I know my question title might not be the most informative, so please let me know if I can improve it somehow :).
I'm trying to figure out how to pass GraphQL variables in a PHP unit test without w...

Get video Id from XML youtube video using PHP

I'm using PHP to process XML information. How can I get from the XML youtube the video id?
Question I have:
> $vid['title'] = $video->title; $vid['date'] = $video->updated;
that works. O...

MongoDB Install: 'php.h' file not found #include <php.h>

I am trying to configure the Apache server on Mac OS Catalina using PHP and MongoDB as the database. I have PHP 7.3.11 Installed.
My httpd file has this line commented out:
LoadModule php7_module l...

Set quantity minimum, maximum and step at product level in Woocommerce

I'm using "set minimum and maximum allowable product quantities to be added in WooCommerce Cart" to require a minimum and maximum quantity order.
Now, i need to impose for several product...

PHP metadata variables based on URL

I am trying to dynamically propagate the title and description on pages within a Website. I am using php and have opted for a switch due to the small number of pages:
Example URL - http://127.0.0....

Uploading file to directory using shared network path

I am unsure why I am able to read files from a directory but not write to it. It is on a shared network path.
I have confirmation from my networking team that "modify permissions" are al...

how to alter enum type column in migration in testing laravel

assuming that I have a code that is running on production and because of this, I can not alter the same migration file for adding new columns, like bellow
use Illuminate\Database\Migrations\Migrati...

Get all weeks of specified month, weeks from Sun-Sat

I tried this code directly below. It's close, but still not finding the weeks from 1st of month to 1st saturday, then every week after from Sun-Sat, until last Sun to end of month.

Adding Image to Carousel Slider

enter image description here

<div id="demo" class="carousel slide" data-ride="carousel">
<?php $count = count($veriler);?>
<ul class="carousel-indicators">

Calculate the total paid from a foreach generated table in codeigniter

I was trying to add paid amount and discount sum to the fee type row but it is repeating for every fee type row if in case it is still unpaid.
<table id="tableFixedHeader" class=...

laravel 7x can't seeding

I'm trying to seed with models in laravel.
I'm using xampp to create database and check data. Table is creating but seeding is not working. (seems working on batch)
Here is code, please check. Than...

Calling frontend controller yii2 using Shell not working

I am new to Yii2 Framework and I am trying to call my controller which is in the frontend folder below
My method to be invoked is

php require_once autoload.php causing 500 error

hi everyone I'm writing a code where I want to use the autoload.php and I had written it as
require_once "database.php";
require_once '/root/vendor/autoload.p...

Google chrome Version 84.0.4147.125 (Official Build) (64-bit) destroying application session when redirecting on callback function from third party

// Creating session before go on third party gateway hosted form
public function ezi_test() {
if (isset($_SESSION['form_data'])) {

PHTML / HTML (with style tags) embedding in Email body (zend Apigiliy Framework) in PHP

I am trying to add the Email body via phtml file inside of the Zend Apigiliy Framework mail service
like this
$oMessage = $oMailService->createHtmlMessage(

Search and Pagination not working while using server-side

I am using the data table server-side. I am getting the records using ajax. My issue is, search and pagination not working. I am getting the search and pagination along with all the data.
Please ch...

PHP How to display a drop downlist with specialized formatting

I have been attempting to figure out how to incorporate a dropdown list in a section of code. It's been rather frustrating. I did not write the primary code but have many numerous modifications.
if ($

Send file from HTML form to AWS S3 Bucket

I'm taking the file from a html form and then uploading it to an AWS S3 bucket.
The following code finds the path of the file on my computer and then uploads it to S3:
$bucketname = 'we-sign-files';

How do you define a 1-1 relationship bidirectionally with phalcon?

I have two tables, work_order and project. On the project records, there is a work_order_id field. There is no project_id on the work_order records. Do I need to add one?
Or is there a way to define

pdftk not executing in php

I can't execute pdftk in php. As in documentation, it is just mentioned as follow to saveas.
use mikehaertl\pdftk\Pdf;
$pdf = new Pdf('/path/my.pdf');
$pdf->allow('AllFeatures') // Change

Open a text file, search for integer and then display text after a character

I have a multi-line text file that contains a number and url
I want to search the file for "59" and then echo the url in img src
If the text

Get all data in row selected base on check box and Insert to new table all row selected On php & Codeigniter 3

Hello guys I need help to my project i have a issue to my Code base on check box selected here is my senario on my project
1 i have a list of table of students and now each student have a different

Create event in outlook calendar with google api

I am using PHP google calendar api to create event in google calendar. Thant was work fine. I need to create event in outlook calendar for some attendees. They do not have gmail account. So I need to

composer require laravel/ui not working for php artisan make:auth in Lumen

I am trying to run php artisan make:auth and get the error that make:provide command not found. I then tried to use the composer require larval/ui command but got an error saying

My PDO Statement doesn't work

This is my PHP sql statement and it's returning false while var dumping
$password_md5 = md5($_GET['password']);
$sql = $dbh->prepare('INSERT INTO users(full_name, e_mail, username, password,

Laravel elastic search returning allocated memory excceded error while installing

Am facing issue of allocated memory exceed while installing laravel elasti search by using below command
Composer install eleasticsearch/elasticsearch
Can any one please help me with same as I tried