Make sure that PHP is configured properly on your server — you should be running PHP 5.4+, GD and Fileinfo extensions should be enabled and JSON MIME type should be supported. While on production servers they are usually enabled, on your local development server it may not be the case. Check the Troubleshooting section for more information on how to change these settings.
When you are sure that your server configuration is correct, complete the steps below to start using CKFinder.
Visit the CKFinder Download site and download the PHP version. Copy the distribution files to your web server and place them inside the /ckfinder/
folder or any other folder of your choice on your website.
By default, the CKFinder server connector is disabled. If you open the default CKFinder sample (located in /ckfinder/samples/full-page-open.html
) you will see the following error message:
The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file.
In order to enable it, you should set the authentication function in config.php
so that it returned true
for users that should have access to CKFinder.
The simplest way to enable CKFinder (insecure, though):
Almost done! If you open the default CKFinder sample again (located in /ckfinder/samples/full-page-open.html
), you will now see CKFinder. Depending on server permissions you may even be able to create a folder or upload files without further actions — if not, read more.
The last important thing that needs to be set is:
CKFinder operates on top-level folders called resource types. By default CKFinder comes with two default resource types configured (Files and Images) that use the same, default backend. It means that all that is required to view and upload files to these folders is to give the web server proper permissions to read and write to the backend location.
CKFinder configuration file comes with a backend called default
that operates on the local file system. This default backend initially points to a URL (/ckfinder/userfiles/
), which is resolved by CKFinder to an appropriate server path.
Once the backend is configured, the last thing to do is to make sure that the web server has write permission to it.
Suppose that CKFinder is installed in https://example.com/
and on the server the full path to the website folder is /home/joe/www/example.com/
. If the backend location (baseUrl
) is set to /userfiles/
, the uploaded files will land in /home/joe/www/example.com/userfiles/
.
Now in order to correctly setup the file permissions:
/home/joe/www/example.com/userfiles/
).userfiles
folder mentioned in point (1) writable for the Internet user:IUSR_<ServerName>
user.chmod
it to 0777
.0777
is insecure, it is advisable to change the group ownership of the directory to the same user as Apache and add group write permissions instead. Please contact your system administrator in case of any doubts.With CKFinder up and running you can now focus on adjusting some configuration options to your needs.
In case when the files managed by CKFinder are served through the web server, it is recommended to perform some server configuration fine-tuning to make sure the files are served in a secure manner. To read more, please have a look at the following two articles:
If you have trouble installing and running CKFinder, check the following tips on how to adjust some server settings in order to resolve your issues. If CKFinder does not work as intended after the initial configuration and your server settings adjustments, please have a look at the Debugging and Logging section.
If you are using IIS Express as your web server, you will need to make sure that JSON is an allowed MIME type. By default it is not allowed which may cause issues with CKFinder language files being unavailable, and you will see the following alert in CKFinder:
You will thus need to add JSON as a new MIME type in your IIS configuration.
Set the following options in the Add MIME Type dialog:
.json
.application/json
.Click OK to accept and restart the server to apply your changes.
By default the Fileinfo extension is disabled on XAMPP server (checked on version 5.6.3). In order to enable it, please proceed as follows:
C:\xampp\php\php.ini
(or another path adequate for the location where XAMPP was installed).;extension=php_fileinfo.dll
.;
from the beginning.You may use this script to test your PHP installation (save it as test.php
and run):
In rare scenarios it may happen that even if GD is enabled, uploading or editing of some images will fail. Such situation happened with PNG files on Mac OSX 10.10 (Yosemite), where the default PHP installation [was defective] (http://stackoverflow.com/questions/26443242/after-upgrade-php-no-longer-supports-png-operations). Issues like this are strictly related to the server-side configuration and would affect any PHP application that works with images, not just CKFinder.