Category "php"

Add Class in html Dynamically in PHP

I am trying to add class in anchor tag dynamically by using Java script or Jquery. I have find many solution but not what i am looking. I am want to use PHP dyn

GRPC installed successfully on ubuntu but php is looking for it in another folder

Using PHP 7.4 & Ubuntu 20.04 LTS I have installed GRPC using these steps: sudo apt-get install autoconf zlib1g-dev php-dev php-pear sudo pecl install grpc

Cache clear probem in Larave

I have a problem. I am download project from hosting. now when I run the project this error shows. pic attached. I think this is cache problem, I clear cache, v

WooCommerce - unset "<product> removed notice…" on cart page

actions and filters. On my WooCommerce site I get the following message when I remove a product from the shopping cart: "<product name>" removed. Undo?

PHP each() function replacement

I read a textbook and it said each() function is deprecated. The author has recommend his own replacement for each() function called myEach() as following: func

laravel-websockets in production with reverse proxy and docker cannot establish connection

I am using laravel-websocket successfully in local and staging environment. However, when in production, I get the error WebSocket connection to '<URL>' f

Check if my GET request has Header: Token

I want to send a request with or without 'Token' as a header. If request has 'Token' as a header: if the user already has that item, it will return the item wit

What would be a proper way to handle tokens in monolith application?

I have a monolith web application powered by Laravel. Users access different forms and some of them have button on them that executes Ajax call to the back-end

How to override header set in Apache config with more specific header in a virtual host

I have a header set in the main Apache (2.4.41 Ubuntu) config with a general CSP: Header always set Content-Security-Policy "frame-ancestors 'self';" I'm tryin

Postgresql/Docker - password authentication failed for user "user"

I have set database with postgresql and docker, now when I want to access to my database I have this connection error saying password authentication failed for

How to set a domain name with php artisan serve

I am new to PHP and Laravel. While virtualhosting with Wamp, I could specify the documentroot, servername and the port number - hence specifying the domain name

How to launch scripts after installing a package via Composer?

I use the command composer require otra/otra:dev-develop --no-update --no-cache && composer update --no-autoloader to install my own framework. I have p

How to pass security cloudflare server with php curl

I used curl for getting data from biorxiv site. This is not an illegal job. $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => '

401 Unauthorized only occurring on some pages in Laravel 8

Have created an app in Laravel 8, and have used the PHP artisan command "ui:auth" to create a login system, which works fine. However, when trying to use "auth(

PHP: PDO + CSV export not downloading (headers issue?)

I'm having a hard time making my CSV export function work. I've found around plenty of examples using mysqli_* functions, but I'm actually using PDOs so I had t

Last order would be re-order in wooCommerce. How is it possible?

I am developing a woocommerce site that has 3 categories like vegetable, Fast food & Fish. vegetables are the main category of his eCommerce site. My client

add " ? " in url via htaccess RewriteRule

i try use RewriteRule in htaccess i want my url site.com/f_search.php?langs=en&langs=en works like site.com/en/new.php?/en/f_search i used this code in

Sort multidimensional array by column value within a column

I have an array in PHP and I need to sort by a nested array inside of the array... Here is my array: Array ( [0] => Array ( [project_

PHP array, move keys and values to new array, but mix it up

so I need to convert a PHP array i'm getting from a form post, so that I can use it more usefully in a db. Array ( [first_name] => Array ( [0]

zsh: command not found: php

I have been using php with mamp on mac for a year even with old versions of MacOS, since I installed MacOS Monterrey if I type php on the terminal I get a messa