Get Started
Usage API
Using WOPI
Additional API
More information
|
How to integrate online editors into your own website on PHPOverviewThis example will help you integrate ONLYOFFICE Docs into your web application written in PHP.
The integration examples are used to demonstrate document editors functions and the ways to connect Document Server to your own application.
DO NOT USE these examples on your own server without PROPER CODE MODIFICATIONS!
If you enabled any of the test examples, disable it before going for production.
Important security infoPlease keep in mind the following security aspects when you are using test examples:
For WindowsStep 1. Install ONLYOFFICE DocsDownload and install ONLYOFFICE Docs (packaged as Document Server). See the detailed guide to learn how to install Document Server for Windows. Step 2. Download the PHP code for the editors integrationDownload the PHP example from our site. To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the config.php file: $GLOBALS['STORAGE_PATH'] = ""; $GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/"; where the documentserver is the name of the server with the ONLYOFFICE Document Server installed and the STORAGE_PATH is the path where files will be created and stored. You can set an absolute path. For example, D:\\folder. Please note that on Windows OS the double backslash must be used as a separator. If you want to experiment with the editor configuration, modify the parameters in the doceditor.php file. Step 3. Install the prerequisitesYou can use any web server capable of running PHP code to run the sample. We will demonstrate how to run the PHP example using the Internet Information Services (IIS) web server. To set up and configure PHP on IIS, PHP Manager for IIS will be used.
Step 4. IIS configuration
After IIS manager configuration is complete, everything is ready for running the PHP example. Step 5. Run your website with the editors
Step 6. Check accessibilityIn case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of documentserver in the configuration files. Make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of example.com in the configuration files. If you integrated the editors successfully the result should look like the demo preview on our site. For LinuxStep 1. Install ONLYOFFICE DocsDownload and install ONLYOFFICE Docs (packaged as Document Server). See the detailed guide to learn how to install Document Server for Linux. Step 2. Install the prerequisites and run the website with the editors
Step 3. Check accessibilityIn case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of documentserver in the configuration files. Make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of example.com in the configuration files. If you integrated the editors successfully the result should look like the demo preview on our site. |