php: added readme
@ -4,7 +4,7 @@
|
||||
|
||||
To integrate **ONLYOFFICE online editors** into your own website on **Java** you need to download and install ONLYOFFICE editors on your local server and use the [Java Example](https://api.onlyoffice.com/editors/demopreview) for their integration.
|
||||
|
||||
You can choose any appropriate way how to run the Java example code. We will show how to run the Java code using the **Apache Tomcat** web server on [Windows OS](https://api.onlyoffice.com/editors/example/java#Windows) and [Linux OS](https://api.onlyoffice.com/editors/example/java#Linux).
|
||||
You can choose any appropriate way how to run the Java example code. We will show how to run the Java code using the **Apache Tomcat** web server on [Windows OS](#running-the-example-on-windows-os) and [Linux OS](#running-the-example-on-linux-os).
|
||||
|
||||
Please note that 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**!
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
To integrate **ONLYOFFICE online editors** into your own website on **Node.js** you need to download and install ONLYOFFICE editors on your local server and use the [Node.js Example](https://api.onlyoffice.com/editors/demopreview) for their integration. We will show you how to run the Node.js example on [Windows OS](https://api.onlyoffice.com/editors/example/nodejs#Windows) and [Linux OS](https://api.onlyoffice.com/editors/example/nodejs#Linux).
|
||||
To integrate **ONLYOFFICE online editors** into your own website on **Node.js** you need to download and install ONLYOFFICE editors on your local server and use the [Node.js Example](https://api.onlyoffice.com/editors/demopreview) for their integration. We will show you how to run the Node.js example on [Windows OS](#running-the-example-on-windows-os) and [Linux OS](#running-the-example-on-linux-os).
|
||||
|
||||
Please nore that 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**!
|
||||
|
||||
|
||||
182
web/documentserver-example/php/README.md
Normal file
@ -0,0 +1,182 @@
|
||||
# How to integrate online editors into your own web site on PHP
|
||||
|
||||
## Introduction
|
||||
|
||||
To integrate **ONLYOFFICE online editors** into your own website on **PHP** you need to download and install ONLYOFFICE editors on your local server and use the [PHP Example](https://api.onlyoffice.com/editors/demopreview) for their integration. We will show you how to run the PHP example on [Windows OS](#running-the-example-on-windows-os) and [Linux OS](#running-the-example-on-linux-os).
|
||||
|
||||
Please note that 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**!
|
||||
|
||||
This guide will show you the sequence of actions to integrate the editors successfully.
|
||||
|
||||
## Running the example on Windows OS
|
||||
|
||||
## Step 1. Download and Install Document Server
|
||||
|
||||
First, download the [**ONLYOFFICE Editors**](https://api.onlyoffice.com/editors/demopreview) (the ONLYOFFICE Document Server).
|
||||
|
||||
See the detailed guide to learn how to [install Document Server for Windows](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx?from=api_php_example).
|
||||
|
||||
## Step 2. Download the PHP code for the editors integration
|
||||
|
||||
Download the [PHP example](https://api.onlyoffice.com/editors/demopreview) from our site.
|
||||
|
||||
You need to connect the editors to your web site. For that specify the path to the editors installation in the *config.php* file:
|
||||
|
||||
```
|
||||
$GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/";
|
||||
```
|
||||
|
||||
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
|
||||
|
||||
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *doceditor.php* file.
|
||||
|
||||
## Step 3. Install the prerequisites
|
||||
|
||||
You can use any web server capable of runnig PHP code to run the sample. We will demonstrate how to run the PHP sample using the **Internet Information Services (IIS)** web server. To set up and configure PHP on IIS, **PHP Manager for IIS** will be used.
|
||||
|
||||
* **IIS: version 7** or later (refer to [Microsoft official website](https://www.iis.net/learn/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php) to learn how to install **IIS**);
|
||||
* **PHP** (download it from the [http://php.net](https://php.net/downloads.php) site);
|
||||
* **PHP Manager for IIS** (download it from the [Microsoft open source site](https://phpmanager.codeplex.com/releases/view/69115)).
|
||||
|
||||
## Step 4. IIS configuration
|
||||
|
||||
1. **PHP Manager for IIS** configuration.
|
||||
|
||||
After **PHP Manager for IIS** installation is complete, launch the **IIS Manager:**
|
||||
|
||||
Start -> ControlPanel -> System and Security -> Administrative Tools -> Internet Information Services (IIS) Manager
|
||||
|
||||
and find the **PHP Manager** feature in the **Features View** in **IIS**.
|
||||
|
||||

|
||||
|
||||
You need to register the installed PHP version in **IIS** using **PHP Manager**.
|
||||
|
||||
Double-click **PHP Manager** to open it, click the **Register new PHP version** task and specify the full path to the main PHP executable file location. For example: *C:\Program Files\PHP\php-cgi.exe*.
|
||||
|
||||

|
||||
|
||||
After clicking **OK**, the new **PHP version** will be registered with IIS and will become active.
|
||||
|
||||

|
||||
|
||||
2. Configure IIS to handle PHP requests.
|
||||
|
||||
For IIS to host PHP applications, you must add handler mapping that tells IIS to pass all the PHP-specific requests to the PHP application framework by using the FastCGI protocol.
|
||||
|
||||
Double-click the **Handler Mappings** feature:
|
||||
|
||||

|
||||
|
||||
In the **Action** panel, click **Add Module Mapping**. In the **Add Module Mapping** dialog box, specify the configuration settings as follows:
|
||||
|
||||
* Request path: ***.php**,
|
||||
* Module: **FastCgiModule**,
|
||||
* Executable: **"C:\[Path to your PHP installation]\php-cgi.exe"**,
|
||||
* Name: **PHP via FastCGI**.
|
||||
|
||||
Click **OK**.
|
||||
|
||||

|
||||
|
||||
After IIS manager configuration is complete, everything is ready for running the **PHP** example.
|
||||
|
||||
## Step 5. Running your web site with the editors
|
||||
|
||||
1. Add your web site in the IIS Manager.
|
||||
|
||||
On the **Connections** panel right-click the **Sites** node in the tree, then click **Add Website**.
|
||||
|
||||

|
||||
|
||||
2. In the **Add Website** dialog box, specify the name of the folder with the PHP project in the **Site name** box.
|
||||
|
||||
Specify the path to the folder with your project in the **Physical Path** box.
|
||||
|
||||
Specify the unique value used only for this website in the **Port** box.
|
||||
|
||||

|
||||
|
||||
3. Browse your web site with the IIS manager:
|
||||
|
||||
Right-click the site -> **Manage Website** -> **Browse**
|
||||
|
||||

|
||||
|
||||
## Step 6. Checking accessibility
|
||||
|
||||
In 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. And you must also 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.
|
||||
|
||||
## Running the example on Linux OS
|
||||
|
||||
## Step 1. Download and Install Document Server
|
||||
|
||||
First, download the [**ONLYOFFICE Editors**](https://api.onlyoffice.com/editors/demopreview) (the ONLYOFFICE Document Server).
|
||||
|
||||
See the detailed guide to learn how to [install Document Server for Linux](https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx?from=api_php_example).
|
||||
|
||||
## Step 2. Install the prerequisites and run the web site with the editors
|
||||
|
||||
1. Install **Apache** and **PHP**:
|
||||
|
||||
```
|
||||
apt-get install -y apache2 php7.0 libapache2-mod-php7.0
|
||||
```
|
||||
|
||||
2. Download the archive with the PHP example and unpack the archive:
|
||||
|
||||
```
|
||||
cd /var/www/html
|
||||
```
|
||||
|
||||
```
|
||||
wget https://api.onlyoffice.com/app_data/editor/PHP%20Example.zip
|
||||
```
|
||||
|
||||
```
|
||||
unzip PHP\ Example.zip
|
||||
```
|
||||
|
||||
3. Change the current directory for the project directory:
|
||||
|
||||
```
|
||||
cd PHP\ Example/
|
||||
```
|
||||
|
||||
4. Edit the *config.php* configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed.
|
||||
|
||||
```
|
||||
nano config.php
|
||||
```
|
||||
|
||||
Edit the following lines:
|
||||
|
||||
```
|
||||
$GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/";
|
||||
```
|
||||
|
||||
Where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
|
||||
|
||||
5. Set permission for site:
|
||||
|
||||
```
|
||||
chown -R www-data:www-data /var/www/html
|
||||
```
|
||||
|
||||
6. Restart apache:
|
||||
|
||||
```
|
||||
service apache2 restart
|
||||
```
|
||||
|
||||
7. See the result in your browser using the address:
|
||||
|
||||
```
|
||||
http://localhost/PHP%20Example/
|
||||
```
|
||||
|
||||
## Step 3. Checking accessibility
|
||||
|
||||
In 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. And you must also 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](https://api.onlyoffice.com/editors/demopreview#DemoPreview) on our site.
|
||||
BIN
web/documentserver-example/php/screenshots/add.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
web/documentserver-example/php/screenshots/browse.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
web/documentserver-example/php/screenshots/handler-add.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
web/documentserver-example/php/screenshots/handlerclick.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
web/documentserver-example/php/screenshots/manager.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
web/documentserver-example/php/screenshots/php-add.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
web/documentserver-example/php/screenshots/php-version-1.jpg
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
web/documentserver-example/php/screenshots/php-version-2.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |