WordPress says “The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.” after uploading an oversized image, then apache promptly dies.
Continue readingCategory Archives: PHP
PHP: Script Base Url
To get the url of current script’s directory:
$script_url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; $dir_url = preg_replace("/[^\/]*.php/", "", $script_url);
Essential Differences between Session and Cookie
- Cookie gets send with every single request to server, sessions don’t.
- Cookies are saved on client side. Sessions on server side.
- Cookie can be created with an expire date (e.g., 30 days), so that users won’t have to re-login after closing browser window. Sessions die with page close*.
PHP: Select from Database Error
$link = mysqli_connect("localhost", "root", "root"); $result = mysqli_select_db($link, 'internship'); $email_duplicate = "SELECT * FROM Interns WHERE email='$email';"; $result = mysqli_query($link, $email_duplicate);
PHP: Check Server Method
if ($_SERVER['REQUEST_METHOD'] === 'POST') {...}
The POST
part is all CAPITAL.