Tag: PHP

How to cache MySQL / MariaDB query results

Contents 0. In MySQL, query caching has been completely removed in recent versions, while in MariaDB, on the contrary, it has become enabled by default. 1. How MySQL / MariaDB query caching works 2. When to use MySQL / MariaDB query caching 3. How to enable and configure MySQL / MariaDB query result caching 4. How to check MySQL /...

How to redirect from JPG, JPEG, PNG and WebP to AVIF using .htaccess and mod_rewrite

In the previous article, we learned how to convert JPG and other formats to AVIF (which is supported by modern web browsers). This can reduce the space occupied by images on the hosting by up to 8+ times! See also: How to convert images to AVIF using PHP But converting images to a new format is just the beginning –...

How to convert images to AVIF using PHP

Contents 1. AVIF format for websites 2. Programs for converting images to AVIF on a server 2.1 Converting to AVIF with the magick utility 2.2 avifenc utility for converting to AVIF 3. Why converting to AVIF with PHP is a worthwhile option 4. Converting files to AVIF in PHP 5. How to use PHP to convert a large number of...

How to insert HTML into PHP script using conditions (without including HTML in PHP code)

Contents 1. Is it possible to mix HTML and PHP code in one file 2. How to use conditions in PHP to output HTML 3. When to use conditions in PHP to output HTML 4. Outputting HTML fragments outside PHP based on conditions in other control statements Conclusion See also 1. Is it possible to mix HTML and PHP code...

Should I close MySQL connections with $mysqli->close() in PHP scripts. Should I use $result->free()

Contents What are $mysqli->close() and $result->free() used for in PHP Is it necessary to close connections to MySQL / MariaDB and clear the result of the SQL query? When using $mysqli->close() and $result->free() will NOT give tangible results When to use $mysqli->close() and $result->free() Is it possible to close the MySQL database connection before completing the processing of query results...

Error “PHP Startup: session.sid_length INI setting is deprecated” (SOLVED)

After upgrading to PHP 8.4, you may have encountered the following error: PHP Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0 Deprecated: PHP Startup: session.sid_length INI setting is deprecated in Unknown on line 0 PHP Deprecated: PHP Startup: session.sid_bits_per_character INI setting is deprecated in Unknown on line 0 Deprecated: PHP Startup: session.sid_bits_per_character INI setting is...

How to install Apache web server with PHP, MySQL and phpMyAdmin on Windows [updated: September 2024]

Table of contents 1. Windows web server 2. How to install Apache on Windows 3. How to install PHP on Windows 4. PHP 8 setup 5. How to install MySQL on Windows 6. How to install phpMyAdmin on Windows Conclusion Windows web server A web server is a program that is designed to process requests for websites and send website pages to users. The most...

How to check if a SQL query result is empty or not empty in PHP

When executing a SQL query to a database, the rows and columns of a table can be returned as the execution result. An empty value can also be returned if no data matching the query is found in the table. The usual algorithm for processing the received response from the database is to fetch the SQL query result row by...

How to find the third root in Linux. How to extract a root of any degree in Linux

Table of contents 1. How to extract a cube root in Linux 2. How to find a cube root in the Linux calculator (GNOME Scientific calculator) 3. How to find a root of any degree in the Linux calculator (GNOME Scientific calculator) 4. How to extract a root of any degree in the command line 4.1 Extracting cube roots using...

PHP regular expressions don't work with very long strings (SOLVED)

preg_replace, preg_match_all, and preg_match functions don't work with long strings When trying to search in PHP using regular expressions using preg_replace, preg_match_all, and preg_match (or other regular expression search functions), the following problem may occur: the string being searched for exactly contains a substring that matches the search pattern; but instead of outputting the matched strings, the function finds nothing....
Loading...
X