Cookies vs. sessions

The concept is storing persistent data across page loads for a web visitor. Cookies store it directly on the client. Sessions use a cookie as a key of sorts, to associate with the data that is stored on the server side. It is preferred to use sessions because the actual values are hidden from the … Read more

Error 500: Premature end of script headers

It was a file permission issue. All files on my website were set to a permission level of ‘644.’ Once I changed the permission level to 705 (chmod 705) everything worked. Note that I changed it to 705, but 755 will also work. I also changed the folder it was in to 701 (to hide … Read more

Resize image in PHP

You need to use either PHP’s ImageMagick or GD functions to work with images. With GD, for example, it’s as simple as… And you could call this function, like so… From personal experience, GD’s image resampling does dramatically reduce file size too, especially when resampling raw digital camera images.

What is difference between PHP cli and PHP cgi?

These are the most important differences between CLI and CGI: Unlike the CGI SAPI, CLI writes no headers to the output by default There are some php.ini directives which are overridden by the CLI SAPI because they do not make sense in shell environments: html_errors: CLI default is FALSE implicit_flush: CLI default is TRUE max_execution_time: … Read more

Is a new line = \n OR \r\n?

\n is used for Unix systems (including Linux, and OSX). \r\n is mainly used on Windows. \r is used on really old Macs. PHP_EOL constant is used instead of these characters for portability between platforms.

PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP

Solution : Rename your function name emailcomm() to __construct() Explanation: In previous versions of PHP, if PHP cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class, but now old style constructors are DEPRECATED in PHP 7.0, and will be removed in a future version. You should always use  __construct() in new code. Read php manual

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)