Don't call echo before ob_gzhandler or you get ERR_CONTENT_DECODING_FAILED error

before the invocation for example the below echo "hello"; ob_start('ob_gzhandler ... '); You will get ERR_CONTENT_DECODING_FAILED error, the reason is with the invocation of ob_gzhandler, the HTTP ... The ob_gzhandler will compress(gzip) the output after the its invocation, if you echo anything ... response tells the browser the content is compressed, but the response output before the invocation

Fatal error: Call to undefined function mysqli_connect_error()

The reason is the mysqli.dll is disabled in php.ini file. Open the phpinfo and find ... the configuration file Edit the file and find the following line ;extension=php_mysqli.dll Remove ... the comment. And then restart Apache server. Check the phpinfo again and find mysqli support ... The error will not occur again.

When not to suppress fatal errors with @ in PHP

In PHP the @ is used to suppress warning or error messages, but it has some serious drawbacks ... the @ operator, you can see the error in the response <b>Fatal error</b>: Call to undefined function ... in PHP configuration file. [It breaks AJAX response] If you specified the response format ... of AJAX as JSON, when a fatal error happens, the server will be interrupted and returns ahead of time

How to debug AJAX response in PHP

The simplest way to debug a normal PHP request is using the echo to output messages ... to browser, but in AJAX, it's not working. In an AJAX request, the response usually was not displayed ... the AJAX response is received and check its value in your debugger for example in Chrome Developer Tools. ... . Without other facilities, the only way to debug it is to set the breakpoint at the place where

CURL download speed is very slow on PHP Apache server

I have a service running on Apache server that use curl php to retrieve web pages ... . For unknown reasons, I notice that the download speed gets very slow. But it's not normal, since I issues ... :// ... , not only the download speed is slow, but also the DNS lookup time. DNS lookup took 13.1 seconds

PHP array_multisort two arrays sort by column example

A common problem we run into in day to day PHP programming is to sort two arrays by one ... column. Especially when the data comes from database. We sometimes need to write code to do the things ... from table order by a desc; SQL is a declaration language and good at such tasks, PHP is an imperative ... . There are several ported LINQ for PHP, check them out if you want to save your precious time

How to use CURL examples and tutorials

('error-curl.txt'); But you can read the file after the function that create and use the curl ... ::: Network is unreachable] The reason of network is unreachable can be the curl tries to use IPv6 ... [How to debug curl with CURLOPT_STDERR and CURLOPT_VERBOSE] Step 1, enable verbose ... mode in curl curl_setopt($ch, CURLOPT_VERBOSE, true); If the problem is connection timeout, you may

Use a plugin pattern in PHP instead of global variable

call it polymorphism. Its tempting to abuse a global variable in PHP to implement it. Declare ... is a solution I used to solve the global variable issue. [Instead of overwrite global variable, we ... . Using a global variable will be a disaster, the abstractions will leaks everywhere. Here ... can use a plugin] A plugin is an implementation can be plugged into a predefined place. And its

Call to undefined function mysql_connect

The reason of the problem is PHP didn't load php_msql.dll correct. Here is how to solve ... the problem. Print the output of phpinfo and search for Loaded Configuration File, and locate ... the configuration file: Open the file with your editor and search for extension_dir Make sure ... the path is right, usually it should point to ext directory of your PHP installation.

PHP date function

For example, I want date in this format

Use format string "Y-m-d"

1 2 ... 5 Next Page