Troubleshooting

From DreamFactory
Jump to: navigation, search
DreamFactoryTroubleshooting

If you experience issues with some of the services, like SQL database connection or server-side scripting, please make sure you have all of the necessary drivers installed with your DreamFactory instance. Depending on the way your instance was installed and the hosting platform, some additional libraries, drivers, or packages may be required for certain services to work properly. See the matrix here for details on necessary drivers.

The following services must be licensed from DreamFactory, and are therefore are not enabled by default: Oracle, SQL Server, IBM DB2, SAP SQL Anywhere, Salesforce, Active Directory, LDAP, and SOAP. Information about purchasing a commercial DreamFactory license to enable these services is here.

If you are unable to install or enable the necessary drivers, please contact DreamFactory Support for assistance.

Note: When the "install directory" is mentioned, it is the DreamFactory code base install that is being referred to. In a Bitnami install, the DreamFactory code base starts at <bitnami install path>/apps/dreamfactory/htdocs/.

Drivers & Modules

Drivers

If you find when you are creating services or testing the API you are receiving an error 'driver not found' you'll first need to check that the drivers are installed properly. If you feel the drivers have been installed correctly you can check which drivers are enabled by running on the command line:

php -m

If the driver is shown in the PHP modules list from the aforementioned command but you still aren't managing a connection you can create a info.php file in your 'public' folder. Open a text editor and place the following at the top of a file called 'info.php':

<?php phpinfo();

Save the file in the 'public' folder of your DreamFactory installation path. Go to 'localhost/info.php' in your browser to view more information about your PHP environment. Look for more information about the driver in question.

Modules

Mcrypt

Installation of mcrypt on a Linux based environment

  • Make sure you get the correct version based on your PHP version. For PHP 7.1 install version 1.0.0. For PHP 7.2, install version 1.0.1. mcrypt on pecl
  • Here is a good tutorial to help you out Install mcrypt

Driver and Module install instructions can be found on the Additional Drivers and Modules page.

Hosting DreamFactory on a Shared Host or VSP

If you are having trouble logging into or navigating around the DreamFactory instance, please check these steps:

  • Confirm PHP version is 7.0 or newer (if using DreamFactory 2.10 and up)
  • Ensure that the webroot path is set correctly and Dreamfactory is in the correct folder
    /public
  • Sometimes, on very rare occasions, the database doesn't complete the 'df:setup' step correctly. Drop the system database, recreate the system database, and re-run
    php artisan df:setup

You can find out more about the supported databases here.


Logging

Most logging done by the DreamFactory instance will be located in a file called dreamfactory.log.

 {install directory}/storage/logs/dreamfactory.log

Other errors may be reported by the web server (i.e. Apache writes to error.log, location based on its configuration), or system log.

DreamFactory Logging Configuration

DreamFactory supports hierarchical Log Level and goes in the following order:

Log Level Description
EMERGENCY Urgent alert.
ALERT Action must be taken immediately. Example: Entire system is down, database unavailable, etc.
CRITICAL Critical conditions. Example: System component unavailable, unexpected exception.
ERROR Runtime errors.
WARNING Exceptional occurrences that are not errors.
NOTICE Uncommon events.
INFO Interesting events. Example: API Request and Responses.
DEBUG Detailed debug information.

Setting your DreamFactory log level to any of these will log that level and the levels above it. So, if you set your log level to ERROR then the system will log all ERROR, CRITICAL, ALERT, and EMERGENCY messages in your log file. By default, log level is set to WARNING. To change it, set APP_LOG_LEVEL to any of the above in your .env file located in your install directory. (Previously, this setting was named DF_LOG_LEVEL.) Here are some additional logging environment settings that you may edit in your .env file.

Parameter Default value Notes
APP_DEBUG false Shows/hides error messages on the web.
APP_LOG single Controls the format of the log file, options are 'single', 'daily', 'syslog', or 'errorlog'.
DF_FREETDS_DUMP Enabling and location of FreeTDS dump file, defaults to disabled or default freetds.conf setting.
DF_FREETDS_DUMPCONFIG Location of FreeTDS connection dump file, defaults to disabled.

Here are some additional logging configuration settings that you may edit in config/df.php:

Parameter Default value Notes
log_cors_info false Enables/disables detailed CORS logging.

Apache Logging Configuration

Finally, when configuring your Apache virtual host, you may configure the Apache logs for your DreamFactory instance to be co-located with your DreamFactory logs. These logs are useful for debugging and troubleshooting both PHP and Apache behavior. For example, in /etc/apache2/sites-enabled/dreamfactory.conf

ErrorLog {install directory}/storage/logs/error.log
CustomLog {install directory}/storage/logs/access.log combined

Clearing Config

When editing the .env file, it is always recommended to run the configuration clear artisan command to clear any cached configuration parameters and read the new changes into DreamFactory.

 php artisan config:clear

Note: If you receive an error that PHP is not recognized as internal or external command you will need to specify the full path to your PHP.

Clearing Cache

When all else fails, clear the cache. Clear the cache using the DreamFactory Admin application by clicking the Config tab, then Cache menu option, and then clicking 'Flush System-Wide Cache'.

You can also clear the cache with the following command in the install directory:

 php artisan cache:clear

Note: If you receive an error that PHP is not recognized as internal or external command you will need to specify the full path to your PHP.

Common Errors

HTTP 400

Error 400 indicates a bad request (malformed.) See detailed error messages below.

No token or api key provided

Login request is missing required email

  • Your login payload was formatted incorrectly, such that the system could not determine the email address of the login request. Please format the call correctly.

Login request is missing required password

  • Your login payload was formatted incorrectly, such that the system could not determine the password of the login request. Please format the call correctly.


No record(s) detected in request

  • Your payload was not formatted correctly, and therefore the system could not recognize the present of any records.
  • See for reference: Posting Records

HTTP 401

Invalid Credentials Supplied

  • You attempted to log in and establish a session, but supplied incorrect credentials.

HTTP 403

Role not found. A Role may not be assigned to you for your App.

  • A role could not be determined in order to allow access to the api call.
    • If the call was made with an api key and a session token, then the user does not have a role assigned for this api key, and the api key has no default role.
    • If the call was make with an api key only, then the api key has no default role.
  • Assign the appropriate role in the admin console.

HTTP 500

  • This is a generic server side error. You will need additional information.
  • Usually more detailed information is available by:
    • Enabling debug logging (APP_LOG_LEVEL=debug) to send the info to the log.
    • Setting APP_DEBUG=true to send debug info back to the client.
    • See Logging for details.


Blank Screen After Install or Upgrade

This can be caused by a number of issues, but the most common is a failure to reset the permissions on the bootstrap/cache and storage directories. These permissions can often be modified during install or upgrade. Try resetting the permissions as outlined in the General Instructions or in the platform specific instructions you used. The default www user for various platforms is below:

  • Ubuntu/Debian
    • www-data
  • CentOS/RHEL - Apache
    • apache
  • CentOS/RHEL - Nginx
    • nginx
  • Linux Bitnami - Non Root
    • the user account that installed the application
  • Linux Bitnami - Root
    • root
  • Linux Bitnami VMs and Cloud VMs
    • root

API Docs or Other Tabs Are Not Viewable

  • Are you using any version of Internet Explorer? If yes, please try FireFox or Chrome. If not, please try clearing your cache with:
 php artisan cache:clear

PHP Out of Memory

If you are seeing for example in your log files:

 Fatal error: Allowed memory size of 268435465 bytes exhausted 

This error is mainly caused by PHP loading more into memory than what PHP currently has allocated for one process. This error has been seen with uploading large files and logging in using Active Directory with a large number of users in the domain. This error may occur elsewhere if a process is resource-intensive.

Edit your php.ini file on the lines shown below. Note: Depending on your installation the php.ini directives may be listed differently or in different order. For a full list of php.ini directives click here. Set the values in bytes according to your needs. Example: 256M, 512M, 64M. PHP supports M,K, and G when setting byte values.

[PHP]
memory_limit = 128M
post_max_size = 32M
upload_max_filesize = 32M

Warning: To have no memory limit, set this directive to -1. We strongly advise against doing this.

If you are running Linux and are not sure how much RAM your machine has, the following commands can help you find this information and understand how the resources are being allocated. These commands may vary depending on what flavor Linux you are running, the recommendations below are for Ubuntu Linux.

Command:

free -m


Output:

 total       used       free     shared    buffers     cached
Mem:          5891       5470        420        440         54       1914
-/+ buffers/cache:       3501       2389


Command:

grep MemTotal /proc/meminfo


Output:

MemTotal:       6032664 kB


Command:

cat /proc/meminfo


Output:

MemTotal:        6032664 kB
MemFree:          482788 kB
MemAvailable:    2220456 kB
Buffers:           55804 kB
Cached:          1987344 kB
SwapCached:          160 kB
Active:          3870728 kB
Inactive:        1289664 kB
Active(anon):    2727688 kB
Inactive(anon):   866484 kB
Active(file):    1143040 kB
Inactive(file):   423180 kB
Unevictable:         320 kB
Mlocked:             320 kB
SwapTotal:       6212604 kB
SwapFree:        6211652 kB
Dirty:               284 kB
Writeback:             0 kB
AnonPages:       3117500 kB
Mapped:           644724 kB
Shmem:            476896 kB
Slab:             253056 kB
SReclaimable:     207940 kB
SUnreclaim:        45116 kB
KernelStack:       11920 kB
PageTables:        62564 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     9228936 kB
Committed_AS:   10936332 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      554624 kB
VmallocChunk:   34358423548 kB
HardwareCorrupted:     0 kB
AnonHugePages:   1230848 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      218880 kB
DirectMap2M:     5994496 kB
DirectMap1G:     1048576 kB


Command:

vmstat


Output:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 3  0    952 478736  55580 1987660    0    0    18    51  160   73  7  1 91  1  0

Database Issues

Changing the Max records returned isn't working as expected.

  • DB_MAX_RECORDS_RETURNED needs to be changed in the .env file and particular database setting as well. Please see the screenshots below:
DB_MAX_RECORDS value

You then migrate over to the Services tab in the admin interface and change the value of the database you want to increase the number of records to be retrieved.

Database Service max records value

SQL Server 2017 not connecting with Windows Server 2016

  • Make sure you have the correct drivers installed and the correct extensions referenced on your php.ini file
  • I think I have the correct drivers installed, but I am getting an error in my console when I check my PHP version for instance:
C:\Bitnami\dreamfactorysilver-2.12.0-0\php>php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/Bitnami/dreamfactorysilver-2.12.0-0/php/ext\php_pdo_sqlsrv_7_ts_x64.dll' - %1 is not a valid Win32 application.
in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:/Bitnami/dreamfactorysilver-2.12.0-0/php/ext\php_sqlsrv_7_ts_x64.dll' - %1 is not a valid Win32 application.

This error is thrown due to the wrong drivers being installed. You will want to add in the 32-bit drivers, php_pdo_sqlsrv_7_ts_x86.dll and php_sqlsrv_7_ts_x86.dll and delete the 64-bit drivers.

Note: In the Microsoft Drivers 5.2.1 for PHP for SQL Server, the x86 and x64 drivers no longer are called out by x86 and x64, so when you download the drivers, make sure you are importing the correct drivers.

MySQL Common Issues with PHP

  • Error: Maximum Execution Time Exceeded: This is a PHP limit; go into the php.ini file and set the maximum execution time up from 30 seconds to something higher, as needed. It is also not a bad idea to double the RAM allowed per script to 16MB instead of 8MB.

Key too long error

This is actually a known issue with Laravel and older MySQL versions.  DreamFactory is a Laravel/PHP based application with an Angular front end.  Please see this article on how to fix this if you wanted to stay with your current version of MySQL:
https://laravel-news.com/laravel-5-4-key-too-long-error