Warning after PHP upgrade "Deprecated: Methods with the same name as their class..."

Issue

After upgrading PHP from 5.4 to 7.0 following warning is displayed: 

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Pages has a deprecated constructor in /home4/webmaster/public_html/website/classes/pages.class.php on line 16

Resolution

The warning can be hidden by setting display_errors to Off in php.ini. Obviously this just hides the issue so a proper fix here is to fix the class in question.

Open the file mentioned in the warring message and find the constructor method. It should look something like this:

 
function Pages($id) {
...
}
 

Read more: Warning after PHP upgrade "Deprecated: Methods with the same name as their class..."

Kunena forum breaks after update

Issue

Joomla's Kunena forum breaks after attempting upgrading to version 5.0.6 (using Joomla auto-updater). Upgrade fails, in the front-end the forum displays "Offline" message. Trying to get into Kunena back-end admin panel triggers an attempt to resume the upgrade which immediately fails again...

Trying to install Kunena manually (uploading pkg_kunena_v5.0.5 package via Joomla's installer) seems to succeed at first, but forum is still broken. Trying to remove the forum and then re-install uploading the same package also seems to succeed, but this breaks Kunena completely. Any attempt to get into Kunena front-end or back-end throws HTTP 500 error page...

Read more: Kunena forum breaks after update

Hostgator shared hosting - emails sent via PHP mail not delivered

Emails sent using PHP mail() function are not reaching recipients. Sender's domain is a domain that has a website hosted on the same Hostgator server (which I believe is a requirement).

After a bit of troubleshooting I found that the issue occurs if recipient's domain has a website hosted on the same Hostgator server as well (but email on a different system).

Read more: Hostgator shared hosting - emails sent via PHP mail not delivered

Simple PEAR PHP script to send emails using AuthSMTP

 
require_once "Mail.php";
function send_mail_pear (){
 $mail_to = 'This email address is being protected from spambots. You need JavaScript enabled to view it., This email address is being protected from spambots. You need JavaScript enabled to view it.';
 $mail_subject = 'Enquiry From Website';
 $mail_from = 'My Website <webmaster@domain>'; // make sure email is authorised in your AuthSMTP account
$mail_body = 'Email body HTML';
 
$headers = array(
 'From' => $mail_from,
 'To' => $mail_to,
 'Subject' => $mail_subject,
 'Content-type' => 'text/html; charset=utf-8');
 
$smtp = Mail::factory('smtp', array(
 'host' => 'ssl://mail.authsmtp.com',
 'port' => '465',
 'auth' => true,
 'debug' => false,
 'username' => 'accountId', // Your AuthSMTP account username
 'password' => 'Password' // Your AuthSMTP account password
 ));
 
$mail = $smtp->send($mail_to, $headers, $mail_body);
 if (PEAR::isError($mail)) { //Email sending failed (to troubleshoot set 'debug' => true)
 return (false);
 } 
 else{ // Email was sent successfully
 return (true);
 }
}
 

Read more: Simple PEAR PHP script to send emails using AuthSMTP



Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait