How to fsync or fdatasync in PHP?

PHP lacks any specific function to fsync on a file AFAIK. I do however feel the urge to fsync a logfile I am appending to from PHP. Is there any native PHP function known to cause an fsync? Or any...

CodeIgniter without a Database?

Sorry if this is a simple question, is it possible to load codeigniter without a db setup? I have sess_use_db set to false in the config, I tried renaming database.php to something else but it...

PHP: fopen() Permission denied

I am confused with this code: test.php: fopen('test.txt','a+'); when I execute it, I get an error: Warning: fopen(test.txt): failed to open stream: Permission denied in...

redirecting to a URL after facebook login

I am trying to redirect my page after successful login to a new url.. <?php include_once "fbmain.php"; $config['baseurl'] = "http://localhost:8080/index.php";; // login or logout...

Why is it not possible to return self in PHP?

In PHP it's not possible to return self to chain static methods. This limits the usage of static methods, because chaining is pretty useful and you have to use instances to chain methods. Are...

Right way to escape backslash [ \ ] in PHP regex?

Just out of curiosity, I'm trying to figure out which exactly is the right way to escape a backslash for use in a PHP regular expression pattern like so: TEST 01: (3 backslashes) $pattern =...

get number after string php regex

I'm using PHP to parse an e-mail and want to get the number after a specific string: For example, I would want to get the number 033 from from this string: Account Number: 033 Account...

Unable to resolve the request yii

I am new in Yii and sorry to say that anyone help me please that why the controller employeController.php not called , I check and set many files permission etc , Here is my url...

How to prevent someone from scraping my website data?

I am using PHP to write my server side code for my website. What is the best way to prevent someone from scraping my data? Like in PHP if someone uses file_get_contents() or someone fetches my...

Prestashop - How to add a custom input field to product customization and write to db

Having gained no response on the official Prestashop forum, I thought I would try turning to you guys, my first post. Thanks for reading. I am building a site that sells personalized items, and it...

php - try, catch, and retry

Sometimes my code breaks and it is out of my control How would I do the following? try { //do my stuff } catch { //sleep and try again } The code isn't that much, so it's all one function, so I...

How to merge images in PHP?

I have two images which are loaded from an external URL. I want to place one image on top of another (keeping the size). I actually don't know the sizes of the images as they are from an external...

The URI you submitted has disallowed characters error on codeigniter

I have a problem. I am using the uri->segment() method of codeigniter to catch a get variable with this string value: "Introducción e Interpretación Norma ISO 9001:2008" It's in spanish and when...

How use arabic letters in php range()

I wanted to use Arabic alphabetic letters as inputs of the range function: foreach (range('ا', 'ی') as $letter) { echo $letter; } I couldn't find any solutions.

Print php table to pdf

I have a table generated by PHP and a lot of MySQL query. It looks like this: I need to print this table to a PDF file. I've tried TCPDF and it works great but it doesn't support external CSS....

How to ORDER BY 'name + 0' in codeIgniter (mysql)

I have a table in a MySQL database that looks like this: id | name 1 | 1 some words 2 | 2 some other words 3 | 1.1 some other words ... 10 | 10 some other words If I sort the table using...

Generating SVG files using PHP

So, I'm attempting to create some tag images for my users, showing the total points that they have earned. I am attempting to write the SVG in a php file which will add in dynamic content, such as...

`composer update` doesn't update to the latest version

In my composer.json I have "require": { . . . "unisharp/laravel-filemanager": "~1.8" } Currently, the latest version is v1.8.2.2 and after running the composer update command I have it...

Shipping cost based on cart total weight in Woocommerce 3

In my Woocommerce Webshop I do have different Products. I would like to have shipping cost calculated on total cart items weight: from 0 to 6 Kilos the cost is 5 €, from 6 to 12 Kilos the cost...

Change COD default order status to "On Hold" instead of "Processing" in Woocommerce

I need help with a problem-related to plugin "WooCommerce Pay for Payment" which counting some extra fee in shipping. Problem is, that this plugin sets automatically "processing" status in order...

How to pass POST data to external site after recaptcha authentication?

I have a form where the action is a script on another website and I need to filter out spam. I have set up recaptcha v2 and changed my form action to point to a local php file which is...

Laravel: vue components not rendering

My vue components are not rendering on the page, despite following tutorials. I have the following layout (master.blade.php): <html> <head> <meta charset="utf-8"> <meta...

Updated css file not reflecting in laravel

I'm working on Laravel framework, I have changed my bootstrap.min.css from v3 to v4 but it's not updated in the browser I have tried: php artisan cache:clear php artisan route:cache php artisan...

Laravel: @if Auth::user()->email and checkbox is checked?

EDIT: Laravel has a build in remember me function. Even when the user does not check the checkbox it keeps you signed in for 2 hours. If you do press the checkbox it remembers you for 5 years I am...

Symfony recipes doesn't apply when installing custom bundle

I'm trying to create a re-usable custom bundle following the great course on SymfonyCasts. But when I try to install it with composer, the symfony recipes doesn't apply. For example, my bundle...

How do we implement custom API-only authentication in Laravel

This isn't a question so much in need of an answer, but further suggestions and answers and recommendations are welcome. I want to share with the world how I resolved this issue and hope it helps...

Docker-compose up : Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))

I am trying to do the docker-compose up command in my terminal. First I navigate to the file directory where I find a docker-compose.yaml. Then I write the command. The Server is on Port 80. I get...

Laravel Passport gets 'It was not possible to parse your key, reason: ""' error after upgrade to PHP8.0

My app works on Laravel 8 with laravel/passport 10.0.1. After upgrading php version on dev server from 7.4 to 8.0, I'm getting It was not possible to parse your key, reason: "" error (without any...

WooCommerce: Order status based on Payment methods

On Woocommerce we have the option for BACS payments. Some orders are coming through as "Paid" and some aren't. I can't understand why as they are using the exact same payment method. The two...

What is the simplest way to write XMP data to a JPEG image in PHP?

I only want to add the 2 fields required by Google for the Licensable badge: Web Statement of Rights Licensor URL I'm able to write standard IPTC fields but these two seems to require XMP. As a...