How-to articles, tricks, and solutions about PHP

configure: error: Please reinstall the libzip distribution

This error message is indicating that there is a problem with the libzip library that is preventing a program from being configured.

Confirm button before running deleting routine from website

Yes, you can add a confirm button before running a delete routine on a website using PHP.

Connect to SQL Server through PDO using SQL Server Driver

Here is an example of how to connect to a SQL Server database using PDO and the SQL Server driver:

Convert a PHP script into a stand-alone windows executable

It is possible to convert a PHP script into a standalone Windows executable using tools such as PHPCompiler by Bambalam or PHPC.exe.

Convert Base64 string to an image file?

To convert a Base64 string to an image file in PHP, you can use the base64_decode() function to decode the Base64 string and then save it as an image file using file_put_contents().

Convert column integer values into date expressions

To convert column integer values into date expressions in PHP, you can use the date function.

Convert date to day name e.g. Mon, Tue, Wed

In PHP, you can use the date function to convert a date to a day name.

Convert flat array to a delimited string to be saved in the database

You can use the implode() function to convert an array to a delimited string in PHP.

Convert multidimensional array into single array

To convert a multidimensional array into a single array in PHP, you can use the array_merge() function.

Convert plain text URLs into HTML hyperlinks in PHP

You can use the preg_replace() function in PHP to convert plain text URLs into HTML hyperlinks.

Converting <br /> into a new line for use in a text area

In PHP, you can use the nl2br() function to convert line breaks (\n or \r\n) to <br /> tags.

Converting Varchar Value to Integer/Decimal Value in SQL Server

In SQL Server, you can convert a varchar value to an integer or decimal value using the CAST or CONVERT function.

correct PHP headers for pdf file download

To download a PDF file in PHP, you will need to use the appropriate HTTP headers.

Could not open input file: artisan

It looks like you are trying to run the artisan command but are getting an error saying that the input file could not be found.

Create a Laravel Request object on the fly

In Laravel, you can create a Request object on the fly by using the create method of the Request facade.

Create Array from Foreach

To create an array from a foreach loop in PHP, you can use the array push function array_push() inside the loop.

create folder in laravel

In Laravel, you can create a new folder using the File facade's makeDirectory method.

Creating anonymous objects in php

In PHP, anonymous objects can be created using the new class syntax.

Creating new Date Time from string

In PHP, you can use the DateTime class to create a new date and time object from a string.

CURL and HTTPS, "Cannot resolve host"

It sounds like you are trying to use curl to make a request to an HTTPS url and are encountering an error that says "Cannot resolve host." This error can occur for a few reasons:

Curl and PHP - how can I pass a json through curl by PUT,POST,GET

To pass a JSON object through cURL using the PUT method, you can use the following command:

curl error 18 - transfer closed with outstanding read data remaining

Error 18 means that the transfer was closed with outstanding read data remaining.

Curl error 60, SSL certificate issue: self signed certificate in certificate chain

This error message appears when curl is unable to verify the SSL/TLS certificate presented by the server.

CURL ERROR: Recv failure: Connection reset by peer - PHP Curl

This error is usually caused by a network issue, such as a lost connection or a network timeout.

curl POST format for CURLOPT_POSTFIELDS

To make a POST request with PHP's cURL functions, you can use the CURLOPT_POST option to send POST data.