Troubleshooting

From DreamFactory
Jump to: navigation, search
DreamFactoryTroubleshooting
(Drivers)
(Drivers)
Line 17: Line 17:
 
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':
 
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':
  
<source lang=php>
+
<syntaxhighlight lang=php><?php phpinfo(); ?></syntaxhighlight>
<?php phpinfo(); ?>
+
</source>
+
  
 
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.
 
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.

Revision as of 18:28, 19 December 2016

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

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(); ?&gt;

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.

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 DF_LOG_LEVEL to any of the above in your .env file located in your install directory. 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.
log_events true Determines if all events dispatched to a handler are logged.
scripting.log_memory_usage false Enables/disables logging memory usage after a script is executed.

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. installed

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

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.

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

  • Usually caused by a PHP error. Enable debug mode in .env and see log file in storage/logs for details, including stack trace.
  • In .env file set APP_DEBUG=true and DF_LOG_LEVEL=DEBUG then clear config as described above.

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