Archive | PHP

RSS feed for this section

Linux: Cron job to monitor for php-fpm service problem

Sometimes, php-fpm service is error, how to monitor for php-fpm service ? Step 1: create a file like check.php with a simple content like and upoad this file to document root (like: /home/vpssim.demo/public_html), you will have the link: http://localhost/check.php Step 2: add a cron job: You can use the command line Then type: i Then […]

Read full story Comments { 0 }

PHP array_shift equivalent in golang

We use reflect as the example: Result:

Read full story Comments { 0 }

PHP parse_str equivalent in golang

PHP parse_str equivalent in golang is url.ParseQuery Example: Result:

Read full story Comments { 0 }

How to prevent ERR_BLOCKED_BY_XSS_AUDITOR on chrome

Sometime, you can see this error: A case i can show: when you post a HTML code from a textarea form. Ex: POST /url in page /url you can add a header: Do by PHP:

Read full story Comments { 0 }

Install PHP 7 on CentOS 7

After I showed last week what problems you can deal with when switching from PHP 5.6 to PHP 7, I would like to show you how to switch to PHP 7 at all. Since I am now migrating to CentOS with all servers, it will be the first time that it is not a Debian […]

Read full story Comments { 0 }

Function apache_request_headers on Nginx

Function apache_request_headers supports only on Apache, how to use it on Nginx. Here is the solution:

Read full story Comments { 0 }

PHP CURL: How to limit read size

In some case, we need to read a first part of a website page or a file (eg a big file). How to limit read size? We can use CURLOPT_WRITEFUNCTION: Example 1: Example 2: get header and more information Result:

Read full story Comments { 0 }

How to install PHP5.6 php-fpm on Centos 7

Step 1: Result: Step 2: Result: Step 3: Step 4: Result: Step 5: Step 6: Result: Step 7: Result: Step 8: Result: Step 9:

Read full story Comments { 0 }

PHP: Example of usage CURLOPT_WRITEFUNCTION

CURLOPT_WRITEFUNCTION: A callback accepting two parameters. The first is the cURL resource, and the second is a string with the data to be written. The data must be saved by this callback. It must return the exact number of bytes written or the transfer will be aborted with an error. Result: Example 2:

Read full story Comments { 0 }

PHP: Example of usage CURLOPT_HEADERFUNCTION

If you set option CURLINFO_HEADER_OUT to true, you can get request header with function curl_getinfo (see example 2) CURLOPT_HEADERFUNCTION: A callback accepting two parameters. The first is the cURL resource, the second is a string with the header data to be written. The header data must be written by this callback. Return the number of […]

Read full story Comments { 0 }