Try the fastest and simplest way to install ONLYOFFICE

Error editing file with the PHP example

Any issues about docs (uploading, editing and etc.)

Error editing file with the PHP example

Postby luis.mas » Wed Aug 26, 2015 9:03 am

Hi everyone,

I've installer OnlyOffice Document Server using docker without problems. In fact, I can access Docker IP and use Document Server and everything works fine.

I'm currently developing an integration with another application developed in PHP. So I downloaded the PHP example, configured it and I'm getting an error. Can you help me? Thanks!!! :cry:

These are the steps I've followed to make the things work:

1. Download de PHP example zip file from here: https://api.onlyoffice.com/app_data/PHP%20Example.zip
2. Configure an Apache VirtualHost with the URL http://onlyofficedemo.com
3. Modify /etc/hosts file to add the URL to 127.0.0.1
4. Uncompress it and modify the config.php file with my configurations (192.168.59.103 is the Docker IP and 8080 is the Docker mapped port):

Code: Select all
<?php

define('WEB_ROOT_URL', 'http://onlyofficedemo.com');

$GLOBALS['FILE_SIZE_MAX'] = 5242880;
$GLOBALS['STORAGE_PATH'] = "";

$GLOBALS['MODE'] = "";

$GLOBALS['DOC_SERV_VIEWD'] = array(".ppt",".pps",".odp",".pdf",".djvu",".fb2",".epub",".xps");
$GLOBALS['DOC_SERV_EDITED'] = array(".docx",".doc",".odt",".xlsx",".xls",".ods",".csv",".pptx",".ppsx",".rtf",".txt",".mht",".html",".htm");
$GLOBALS['DOC_SERV_CONVERT'] = array(".doc",".odt",".xls",".ods",".ppt",".pps",".odp",".rtf",".mht",".html",".htm",".fb2",".epub");

$GLOBALS['DOC_SERV_TIMEOUT'] = "120000";

$GLOBALS['DOC_SERV_STORAGE_URL'] = "http://192.168.59.103:8080/FileUploader.ashx";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "http://192.168.59.103:8080/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "https://doc.onlyoffice.com/OfficeWeb/apps/api/documents/api.js";

$GLOBALS['DOC_SERV_PRELOADER_URL'] = "https://doc.onlyoffice.com/OfficeWeb/apps/api/documents/cache-scripts.html";


$GLOBALS['ExtsSpreadsheet'] = array(".xls", ".xlsx",
                                    ".ods", ".csv");

$GLOBALS['ExtsPresentation'] = array(".pps", ".ppsx",
                                    ".ppt", ".pptx",
                                    ".odp");

$GLOBALS['ExtsDocument'] = array(".docx", ".doc", ".odt", ".rtf", ".txt",
                                ".html", ".htm", ".mht", ".pdf", ".djvu",
                                ".fb2", ".epub", ".xps");

if ( !defined('ServiceConverterMaxTry') )
    define( 'ServiceConverterMaxTry', 3);

if ( !defined('ServiceConverterTenantId') )
    define( 'ServiceConverterTenantId', '');
if ( !defined('ServiceConverterKey') )
    define( 'ServiceConverterKey', '');

?>


5. Access to http://onlyofficedemo.com and it shows the upload form
6. Upload one .doc file and it uploads ok
7. Click in "Edit" button and finnaly I get this error:

URL:
Code: Select all
https://doc.onlyoffice.com/CanvasService.ashx

Parameters:
Code: Select all
{"id":"3811764809","userid":"uid-1440579166276","format":"docx","vkey":"d08xNTAvQmxkcjA5VThzbnh1VU1ER3NneWcrYkZMVWlnSFRjY2ZEMXpzdz0_eyJleHBpcmUiOiJcL0RhdGUoMTQ0MDU3OTE2NDExOSlcLyIsImtleSI6IjM4MTE3NjQ4MDkiLCJrZXlfaWQiOiIiLCJ1c2VyX2NvdW50IjowLCJpcCI6IjEyNy4wLjAuMSJ90","editorid":0,"c":"chopen"}

Error:
Code: Select all
{"type":"err","data":"-81"}
luis.mas
 
Posts: 8
Joined: Wed Aug 26, 2015 8:55 am

Re: Error editing file with the PHP example

Postby luis.mas » Thu Aug 27, 2015 7:25 am

Ok so I found the error and apply the solution. The problem was the config file: the server converting and server api URL's where pointing to onlyoffice.com not to my local server.

You can close the post! :)
luis.mas
 
Posts: 8
Joined: Wed Aug 26, 2015 8:55 am


Return to Documents

Who is online

Users browsing this forum: No registered users and 1 guest