500 error when $use_phpmailer=true - SMTP config.php

:warning: IMPORTANT, please fill the questions

We assume you are using Bitnami to deploy your application.

  • Which version of the application are you using?:
    8.1.9869

  • Please choose how you got the application: Installer (Windows, Linux, macOS), cloud image (AWS, GCE, Azure, …) or VM (VMDK, VBOX):
    AWS Cloud Image

  • Have you installed any plugin or modified any configuration file?:
    Yes. Embeddocument, embedslideshow, flikr_theme_publish, google_analytics, propose_changes, rse_version, transform
    My config.php file has the SMTP settings in it, Paths to exiftool, antiword, and pdftotext.

  • Describe here your question/suggestion/issue (expected and actual results):
    I am having trouble with setting up SMTP, specifically related to the requirement with $use_phpmailer=true
    I can confirm that my google apps account is set up for “less secure apps”
    Here is an extract from my config.php

$use_smtp=true;
$smtp_secure=‘tls’; # ‘’, ‘tls’ or ‘ssl’. For Gmail, ‘tls’ or ‘ssl’ is required.
$smtp_host=‘smtp.gmail.com’; # Hostname, e.g. ‘smtp.gmail.com’.
$smtp_port=587; # Port number, e.g. 465 for Gmail using SSL.
$smtp_auth=true; # Send credentials to SMTP server (false to use anonymous access)
$smtp_username=‘xx@xx.com’; # Username (full email address).
$smtp_password=‘xx’; # Password.
$use_phpmailer=true

When $use_phpmailer=true, my entire resourcespace stops working – I get a 500 internal server error.
When I comment out that line in config.php resourcespace works fine, but then unfortunately, SMTP doesn’t work, and I am unable to send system emails from resourcespace to my users.

Any ideas on how to debug or resolve?

  • Steps to reproduce the issue (if relevant):
    Copy paste my SMTP config above exactly into your config.php.
    Save config and restart apache.
    Going to http://yourresourcespaceinstallation.com/ will result in a 500 internal server error.

Hi,

Could you let us know which errors appear in the Apache logs?

/opt/bitnami/apache2/logs/error_log

Best regards,

Javier J. Salmerón

Hi, when it is commented out here is what the log looks like:

[Tue May 09 09:50:28.309529 2017] [mpm_event:notice] [pid 21684:tid 139936311539520] AH00491: caught SIGTERM, shutting down
[Tue May 09 09:50:32.344414 2017] [ssl:warn] [pid 22809:tid 140115566876480] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue May 09 09:50:32.383217 2017] [ssl:warn] [pid 22810:tid 140115566876480] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue May 09 09:50:32.401558 2017] [mpm_event:notice] [pid 22810:tid 140115566876480] AH00489: Apache/2.4.25 (Unix) OpenSSL/1.0.2k configured – resuming normal operations
[Tue May 09 09:50:32.401600 2017] [core:notice] [pid 22810:tid 140115566876480] AH00094: Command line: ‘/opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf’

When it is not commented out, here is what it looks like:

[Tue May 09 09:51:37.277890 2017] [mpm_event:notice] [pid 22810:tid 140115566876480] AH00491: caught SIGTERM, shutting down
[Tue May 09 09:51:41.313551 2017] [ssl:warn] [pid 23935:tid 139948304717632] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue May 09 09:51:41.353940 2017] [ssl:warn] [pid 23936:tid 139948304717632] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue May 09 09:51:41.371854 2017] [mpm_event:notice] [pid 23936:tid 139948304717632] AH00489: Apache/2.4.25 (Unix) OpenSSL/1.0.2k configured – resuming normal operations
[Tue May 09 09:51:41.371897 2017] [core:notice] [pid 23936:tid 139948304717632] AH00094: Command line: ‘/opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf’
[Tue May 09 09:52:03.350231 2017] [mpm_event:notice] [pid 23936:tid 139948304717632] AH00491: caught SIGTERM, shutting down
[Tue May 09 09:52:07.390955 2017] [ssl:warn] [pid 25057:tid 140476002363200] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue May 09 09:52:07.432470 2017] [ssl:warn] [pid 25058:tid 140476002363200] AH01909: localhost:443:0 server certificate does NOT include an ID which matches the server name
[Tue May 09 09:52:07.449838 2017] [mpm_event:notice] [pid 25058:tid 140476002363200] AH00489: Apache/2.4.25 (Unix) OpenSSL/1.0.2k configured – resuming normal operations
[Tue May 09 09:52:07.449883 2017] [core:notice] [pid 25058:tid 140476002363200] AH00094: Command line: ‘/opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf’
[Tue May 09 09:52:09.009154 2017] [proxy_fcgi:error] [pid 25069:tid 140475786135296] [client 120.63.219.207:57926] AH01071: Got error ‘PHP message: PHP Parse error: syntax error, unexpected ‘$contact_link’ (T_VARIABLE) in /opt/bitnami/apps/resourcespace/htdocs/include/config.php on line 67\n’
[Tue May 09 09:52:09.932230 2017] [proxy_fcgi:error] [pid 25074:tid 140475436500736] [client 120.63.219.207:57927] AH01071: Got error ‘PHP message: PHP Parse error: syntax error, unexpected ‘$contact_link’ (T_VARIABLE) in /opt/bitnami/apps/resourcespace/htdocs/include/config.php on line 67\n’
[Tue May 09 09:52:10.544297 2017] [proxy_fcgi:error] [pid 25076:tid 140475786135296] [client 120.63.219.207:57928] AH01071: Got error ‘PHP message: PHP Parse error: syntax error, unexpected ‘$contact_link’ (T_VARIABLE) in /opt/bitnami/apps/resourcespace/htdocs/include/config.php on line 67\n’
[Tue May 09 09:52:11.040582 2017] [proxy_fcgi:error] [pid 25078:tid 140475786135296] [client 120.63.219.207:57929] AH01071: Got error ‘PHP message: PHP Parse error: syntax error, unexpected ‘$contact_link’ (T_VARIABLE) in /opt/bitnami/apps/resourcespace/htdocs/include/config.php on line 67\n’

Line 67 of config.php is

SMTP settings

Use an external SMTP server for outgoing emails (e.g. Gmail).

Requires $use_phpmailer.

$use_smtp=true;

SMTP settings:

$smtp_secure=‘tls’; # ‘’, ‘tls’ or ‘ssl’. For Gmail, ‘tls’ or ‘ssl’ is required.
$smtp_host=‘smtp.gmail.com’; # Hostname, e.g. ‘smtp.gmail.com’.
$smtp_port=587; # Port number, e.g. 465 for Gmail using SSL.
$smtp_auth=true; # Send credentials to SMTP server (false to use anonymous access)
$smtp_username=‘x@x.com’; # Username (full email address).
$smtp_password=‘29fiuts78’; # Password.
$use_phpmailer=true

/*

New Installation Defaults

The following configuration options are set for new installations only.
This provides a mechanism for enabling new features for new installations without affecting existing installations (as would occur with changes to config.default.php)

*/

// Set imagemagick default for new installs to expect the newer version with the sRGB bug fixed.
#$imagemagick_colorspace = “sRGB”;

// No “contact us” link for new installations
$contact_link=false;

Before 67, it was this $imagemagick_colorspace = “sRGB”; that was giving the error. I commented it out, and now its this $contact_link=false; that is being referred to in the error log.

Ok, never mind. It was really silly. There was no ; at the end of the $use_phpmailer statement. I feel very very :confounded:

Hi,

Good to know that was the cause of the issue! Please let us know if you run into more issues :slight_smile:

Best regards,

Javier J. Salmerón