Category "php"

PHP and WebView - Cookie doesn't are the same

I'm using a WebView to show a web application. All works, except one thing: My login: setcookie("USER_ID", $my_id, time() + 86400); My logout: setcookie("U

PHP Download MP3 files from directory on server

I am attempting to download MP3 files to the user computer located in a directory named "songs" on the server. I have been able to run a script which downloads

Laravel websockets AWS EC2 - Connection failed

I'm using laravel-websockets and is working like a charm in my local docker machine but I can't seem to make it work when I deploy it in the AWS EC2 machine. Th

Correct way to use LIKE '%{$var}%' with prepared statements?

This does not work $sql = 'SELECT * FROM `users` WHERE username LIKE \'%{?}%\' '; Warning: mysqli_stmt::bind_param(): Number of variables doesn't match numbe

Exact alternate to mcrypt_encrypt in PHP 7.2

Since mcrypt_encrypt is no longer supported in PHP 7.2, I am trying for exact alternate to this function. After reading many SO answers I have found the foll

"properties should not be accessed directly" issue during WooCommerce 3.0 checkout

My log shows a lot of the following messages: order_total was called incorrectly. Order properties should not be accessed directly. This message was added in v

MySQL Filter JSON_CONTAINS Any value from Array

I have a JSON field in a MySQL database that contains values like [1,3,4,7]. I would like to be able to easily supply another array from a PHP variable and det

CodeIgniter Fatal error: Cannot redeclare class

I'm getting the error: Fatal error: Cannot redeclare class News in application\models\Entities\News.php The two classes are as follow: application/models/News

Move a child array to parent array and change parent/child name

I know probably this was asked before not sure if was in this form but I did tried some replay from what I found here about this and failed. ok I have this arr

Telegram bot doesn't answer

I'm using the package of eleirbag89 http://eleirbag89.github.io/TelegramBotPHP to create my bot on telegram. I'm having some issues on it, it doesn't answer me

How do I call Validator from a namespace with an already existing Validator class

I'm trying to test a function in phpspec which calls Laravel's Validator::make function (http://laravel.com/docs/4.2/validation) However, I'm trying to call th

Get orders by date and status woocommerce

I need get a list of orders in woocommerce passing start date, final date and status. I tryed use some techniques like described by Mike Jolley, and I mixed wi

Which is faster php date functions or carbon?

Carbon is simple PHP API extension for DateTime. I want to know that we can use datetime functions using by installing carbon via composer. which is faster ph

Sync AWS Elasticache(Redis) to MySQL Database Table

I am using AWS Elasicache(Redis) using PHP & MySQL for different caching purposes that are mentioned below Reducing the load on MySQL Session Handling Datab

(Laravel) How to delete multiple models including optional relationships?

Summary I'm trying to let my model controller delete multiple models (selected by an array of IDs) including their selected related models (selected by an arra

Call to undefined function openssl_decrypt

When I try to make a request with POST to a script that has this line: $decrypted_data = openssl_decrypt($encrypted_data, 'AES-256-CBC', $key); I get the fol

How can I send a Carousel like message in Telegram bot?

I've been searching for something like this https://cdn-images-1.medium.com/max/800/1*pLXaOT2WwxRptVxOvuvX8w.png in Telegram to no avail. Anyone out there can p

Auto increment id JSON

I'm making a RESTful webservice and I want the items that are posted to the JSON file to have an Id. I've been searching everywhere but couldn't find anything o

Captcha Helper Codeigniter Error - imagettftext(): Could not find/open font

please help me solve this problem. I want to use the captcha in my login page using captcha helper in CodeIgniter, but got some error like this : A PHP Error w

Why getting "Build step 'Execute shell' marked build as failure" error while creating a backup tar for files

We are trying to run a job in jenkins server. Before deploying I am trying to create a tar file of all files and folders. Whenever I try to build job tar file i