Learn about Centmin Mod LEMP Stack today
Become a Member

Error 500 on contact page (send Mail)

Discussion in 'Other Web Apps usage' started by aaran p, Nov 30, 2016.

  1. aaran p

    aaran p New Member

    Nov 24, 2016
    Local Time:
    12:07 PM

    Im having trouble getting my contact form working that was coded in php, its not my own i found it online but it works on my own xampp install but not my Dev VPS with centmin install.

    the php script in general is this

     * Vanilla Form v. 2.0.0
     * Author: Michal Szepielak
     * Vanilla Form v. 2.0.0
     * Author: Michal Szepielak
    use VanillaForm\MailSender;
    use VanillaForm\Utils;
    header('Access-Control-Allow-Origin: *');
     * Check if call is a POST request (data was sent by form).
     * While it's not a POST request it returns OK, which can be handy with checking that the script is alive.
    if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
        if (function_exists('mail')) {
        } else {
            die('PHP parser works, but <b>mail()</b> function seems to doesn\'t exist');
     * Vanilla Configuration starts HERE
    $vf_config = array(
        /*** Code Snippet - quick-start ***/
         * Recipient's e-mail. To this e-mail email will be sent.
         * E.g. Single recipient
         * 'emailRecipients' => '[email protected]',
         * E.g. Multiple recipients
         * 'emailRecipients' => '[email protected], [email protected]',
        'emailRecipients' => '[email protected], [email protected]',
         * If is not empty it sets a header From in e-mail message (sets sender e-mail).
         * Note: some hosting servers can block sending e-mails with custom From field in header.
         * If so, leave this field as empty.
         * E.g. Single recipient
         * 'emailSender' => '[email protected]',
        'emailSender' => '[email protected]'
        /*** /Code Snippet - quick-start ***/
    $vfSender = new MailSender($vf_config);
     * Some variable may need translation for better readability.
     * You can access and modify variables by:
     * $vfSender->data['variable-name']
    switch ($vfSender->data['gender']) {
        case "F":
            $vfSender->data['gender'] = "Female";
        case "M":
            $vfSender->data['gender'] = "Male";
            $vfSender->data['gender'] = "Not selected";
    // Define here subject of the e-mail message
    $subject = 'Vanilla Contact Form - New Message from '.$vfSender->data['name'];
    // Define here content of the e-mail message
    $content = "Hey,
    You've received new message from your website. Check the details below:
    Sender's IP address: ".Utils::getIp()."
    Name: {NAME}
    Gender: {GENDER}
    E-mail: {EMAIL}
    Phone number: {TEL}
    Selected department: {DEPARTMENT}
    // Set subject and message content
    $vfSender->setMessage($subject, $content);
     * Vanilla Configuration ends HERE
    To see were this is being implimented please gook at the following link AP Repair - Contact Us!

    thanks for looking even if its something you cant help with :)
  2. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    10:07 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    Checking PHP-FPM etc logs

    You'll also need to check into your PHP-FPM, Nginx and MariaDB logs which you can find as outlined at How to troubleshoot Centmin Mod initial install issues

    Server logs include Nginx, PHP-FPM, MariaDB MySQL error logs as well as others. You can find your Centmin Mod install/menu logs at FAQ 7 and server logs at FAQ 19 at Centmin Mod FAQ (most up to date info in FAQ so always read that first). Spoiler tag below has info too but may not be up to date.

    Some of Centmin Mod's installed software will have their own access and error logs which maybe useful for diagnosing errors or give info, notes, or warning notices.

    Note: There's no support provided by me for diagnosing such errors which may occur for various reasons including misconfiguration of installed php/mysql scripts or applications.

    In SSH2 telnet you can use tail command to view the last X number of lines in the file.

    For example for viewing last 10 lines in the file for:

    For Nginx access and error logs:
      tail -10 /usr/local/nginx/logs/access.log
      tail -10 /usr/local/nginx/logs/error.log
    For specific domainname.com access and error log:
      tail -10 /home/nginx/domains/domainname.com/log/access.log
      tail -10 /home/nginx/domains/domainname.com/log/error.log
    For other system error logs located at /var/log:

    list /var/log files in ascending time order so the most recently modified files are at the bottom
      ls -lhrt /var/log
    total 2.7M
    -rw------- 1 root  root    0 Aug 29 15:33 tallylog
    -rw------- 1 root  root    0 Aug 29 15:33 spooler
    drwx------ 3 root  root 4.0K Aug 29 15:35 samba
    drwxr-xr-x 2 root  root 4.0K Aug 29 15:35 mail
    -rw-r--r-- 1 root  500     0 Oct  8 18:13 dmesg.old
    -rw------- 1 root  500     0 Oct  8 18:13 boot.log
    -rw-r--r-- 1 root  500     0 Oct  8 18:14 dmesg
    drwx------ 2 root  root 4.0K Oct  8 18:14 httpd
    drwxr-xr-x 2 root  root 4.0K Oct  8 19:08 php-fpm
    -rw-rw---- 1 mysql root 2.3K Oct  9 12:38 mysqld.log
    -rw------- 1 root  root 9.2K Oct 26 10:48 yum.log
    -rw------- 1 root  utmp  94K Nov  7 22:59 btmp
    drwxr-xr-x 2 root  root 4.0K Nov  8 00:00 sa
    -rw------- 1 root  root 269K Nov  8 21:39 messages
    -rw------- 1 root  root 110K Nov  8 23:08 secure
    -rw-rw-r-- 1 root  utmp  43K Nov  8 23:08 wtmp
    -rw-r--r-- 1 root  root 144K Nov  8 23:08 lastlog
    -rw------- 1 root  root  69K Nov  8 23:08 lfd.log
    -rw------- 1 root  root 332K Nov  8 23:08 maillog
    -rw------- 1 root  500  1.6M Nov  8 23:10 cron
    For PHP-FPM error log:
      tail -10 /var/log/php-fpm/www-error.log