Change php.ini to increase duration of session

For Ubuntu Server php.ini is located at /etc/php5/apache2/php.ini sudo nano /etc/phpX/apache2/php.ini Simply change the default value of 1440 to your desired value for session.gc_maxlifetime increase duration of session #session.gc_maxlifetime = 1440 session.gc_maxlifetime = 7200 Restart apache service to apply change sudo service apache2 restart You could verify by calling below page <?php echo ini_get("session.gc_maxlifetime"); ?>...

Test your php mail function

<?php $headers = “From: contact@domain.com\r\n”;$headers .= “Reply-To: contact@domain.com\r\n”;$headers .= “Return-Path: contact@domain.com\r\n”;#$headers .= “CC: contact@domain.com\r\n”;#$headers .= “BCC: contact@domain.com\r\n”; $to = “kim@domain.com.sg”;$subject = “Test email subject”;$message = “Message body”; if ( mail($to,$subject,$message,$headers) ) {echo “Email sent successfully!”;} else {echo “Email failed!”;} ?>...

PHP tips and shortcuts

If and else statement with isset Usual method <?php if(isset($_SERVER)){     // Print HTTP_REFERER     echo $_SERVER; }else{     // Print nothing     echo ""; } ?> Shortcut <?php echo isset($_SERVER) ? $_SERVER : ""; ?> Same in Laravel {{ $_SERVER or 'empty' }}   Loop <?php foreach ($people as $p) : ?> <li><?=...

Scroll to top