Getting Started with PrizmDoc > Integrating the Viewing Client with Your Application > Configuring the Viewing Client Samples > PHP Sample |
The PrizmDoc PHP Sample requires PHP version 5.4 and above.
Example Copy Code Alias /pccis_sample /usr/share/prizm/Samples/php <Directory /usr/share/prizm/Samples/php> AllowOverride All Require all granted </Directory>
Example Copy Code apache2ctl configtest
Example Copy Code apache2ctl restart
For Ubuntu users: In Ubuntu 13 and up, the php_curl module was unbundled from the default PHP install. This module is required by the PHP sample, and should be installed separately, as such:
Example |
Copy Code
|
---|---|
sudo apt-get install php5-curl
|
Depending on how you install PHP for Apache, you may need to install the Apache PHP addition, as such:
Example |
Copy Code
|
---|---|
sudo apt-get install libapache2-mod-php5
|
When running PHP Web Tier on Security-Enhanced Linux you may experience issues with loading documents in the Viewing Client, and may see the following errors in Apache's log files: PHP Warning: file_get_contents(<URL>): failed to open stream: Permission denied
The reason for the error is because the Web Tier needs to contact the PrizmDoc Server. By default SELinux disallows Apache processes from connecting out. You can run the following command to allow the web tier to function:
Example |
Copy Code
|
---|---|
setsebool -P httpd_can_network_connect 1 |
Similarly, when attempting to upload a document, the PHP application may appear unresponsive. When reviewing the document upload response in your browser’s console, you may see a 403 Forbidden error. Security-Enhanced Linux prevents the PHP / Apache HTTP application from writing to the file system by default. You can run the following command to set the httpd_sys_rw_content_t policy for the Samples directory:
Example |
Copy Code
|
---|---|
chcon -R -t httpd_sys_rw_content_t /usr/share/prizm/Samples/ |
By default, the PHP sample is installed to: C:\Prizm\Samples\php, assuming use of the default PrizmDoc location of C:\Prizm.
Install IIS, along with the CGI component, and then install and configure PHP. The instructions and installer provided on the IIS site are now old and outdated, as they install PHP version 5.3. Instead, install the latest version of PHP using the Web Platform Installer. If using an already configured server, make sure you are using PHP version 5.4 or higher.
To configure the sample:
Now you can browse to http://localhost/pccis_sample/splash in your browser to see the PHP sample.
Install Apache, or an Apache stack like XAMPP or WAMP server, and a supported version of PHP.
To configure the sample:
Example Copy Code # PCC PHP sample alias Alias /pccis_sample "C:/Prizm/Samples/php" <Directory "C:/Prizm/Samples/php"> Allow from all Require all granted </Directory>
Now you can browse to http://localhost/pccis_sample/splash in your browser to see the PHP sample.
By default, PHP has a small file size upload. If you need to be able to upload larger files through the splash page, you may need to change the following values in the php.ini file of your PHP installation:
Example |
Copy Code
|
---|---|
upload_max_filesize = 1000M post_max_size = 1000M |
This sets the file upload to 1GB, which should be enough to test most files through the splash page. These settings may be too high for a production service, so adjust those accordingly when deploying to production.
When running PHP Web Tier on Security-Enhanced Linux you may experience issues with loading documents in the Viewing Client, and may see the following errors in Apache's log files: PHP Warning: file_get_contents(<URL>): failed to open stream: Permission denied
The reason for this is that the Web Tier needs to contact the PrizmDoc Server. By default SELinux disallows Apache processes from connecting out. You can run the following command to allow the web tier to function:
Example |
Copy Code
|
---|---|
setsebool -P httpd_can_network_connect 1 |
From the splash page you have two options:
You can choose any of the 5 sample documents (Word, PDF, CAD, Tiff or JPEG). Or, you can upload a document from an arbitrary location on your computer. Note that dragging and dropping a file on this page is not supported in Internet Explorer 8.
If you select Full Viewer on the splash page, then documents will be viewed with the full-featured, out-of-the-box responsive Viewing Client:
If you select Book Reader on the splash page, then documents will be viewed with the book reader. The book reader demonstrates how the Viewing Client can be heavily customized:
This folder contains 6 sub-folders, one folder for each of the four samples (full Viewing Client, book reader, e-signer and e-signer template designer) and two folders for the splash pages (main splash page and the e-sign splash page):
Each of the sample folders are completely self-contained, meaning that they contain all of the files needed to run the sample. Furthermore, with the exception of a few project files and build files, the sample folders contain only the files needed to run the sample.
File / Folder |
Description |
viewer-assets folder |
Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the Viewing Client. |
viewer-assets/less folder |
Contains less that can be used to build the Viewing Client CSS. This folder is non-essential, and does not need to be re-distributed. |
viewer-assets/Gulpfile.js |
Contains Gulp tasks to build the viewer less and icons. This file is non-essential and does not need to be re-distributed. |
viewer-assets/package.json |
A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Grunt and compile the less. |
viewer-webtier folder |
Contains files that implement the php layer of communication between the Viewing Client and the PrizmDoc Application Services. |
viewer-webtier/pas.php |
Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services. |
viewer-webtier/pcc.config |
Defines the connection settings for the PrizmDoc Application Services. |
viewer-webtier/PccViewer/Config.php |
This class parses the pcc.config file and provides methods for easily reading its parameters. |
index.php |
The default web starting page in this sample. The Viewing Client's code gets loaded by this page. |
.htaccess |
Contains Apache web server settings. |
predefinedSearch.json |
This data file contains information defining search queries that will appear as selectable items in the full Viewing Client. Note: This file is consumed by the page Default.aspx and the JSON is injected into the HTML that is returned by Default.aspx. Ultimately, the predefined search terms are provided as a JavaScript hash, when the Viewing Client is created. |
redactionReason.json |
This data file contains information defining redaction reasons that are available in the Viewing Client. Note: This file is consumed by the page Default.aspx and the JSON is injected into the HTML that is returned by Default.aspx. Ultimately, the redaction reasons are provided as a JavaScript hash, when the Viewing Client is created. |
File / Folder |
Description |
viewer-assets folder |
Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader Viewing Client. |
viewer-assets/less folder |
Contains less that can be used to build the Viewing Client CSS. This folder is non-essential, and does not need to be re-distributed. |
viewer-assets/Gruntfile.js |
Contains Grunt tasks to build the viewer less. This file is non-essential and does not need to be re-distributed. |
viewer-assets/package.json |
A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Grunt and compile the less. |
viewer-assets/selection.json |
A file used by the IcoMoon application to generate the icons in the book reader Viewing Client. If you need to add an icon to the Viewing Client, you can add the icon to this file and use the IcoMoon application (https://icomoon.io) to generate a new icon font. This file is non-essential and does not need to be re-distributed. |
viewer-webtier folder |
Contains files that implement the php layer of communication between the book reader Viewing Client and the PrizmDoc Application Services. |
viewer-webtier/pas.php |
Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services. |
viewer-webtier/pcc.config |
Defines the connection settings for the PrizmDoc Application Services. |
viewer-webtier/PccViewer/Config.php |
This class parses the pcc.config file and provides methods for easily reading its parameters. |
index.html |
The default page for the sample. This page loads the Viewing Client. |
sample-config.js |
Contains references to the assets, web tier, and language files used by the Viewing Client in this sample. |
.htaccess |
Contains Apache web server settings. |
File / Folder |
Description |
viewer-assets folder |
Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader Viewing Client. |
modules folder |
Contains uncompiled assets of the Viewing Client. These files will be compiled to viewer-assets/js/bundle.js and viewer-assets/css/bundle.css by the build process defined in Gulpfile.js. The files in this folder are non-essential and do not need to be re-distributed. |
Gulpfile.js |
Contains Gulp tasks to build the viewer js and css files. This file is non-essential and does not need to be re-distributed. |
viewer-assets/package.json |
A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Gulp and compile the Viewing Client assets.This file is non-essential and does not need to be re-distributed. |
viewer-webtier folder |
Contains files that implement the php layer of communication between the book reader Viewing Client and the PrizmDoc Application Services. |
viewer-webtier/pas.php |
Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services. |
viewer-webtier/pcc.config |
Defines the connection settings for the PrizmDoc Application Services. |
viewer-webtier/PccViewer/Config.php |
This class parses the pcc.config file and provides methods for easily reading its parameters. |
index.html |
The default page for the sample. This page loads the Viewing Client. |
.htaccess |
Contains Apache web server settings. |
webpack.config.js |
Webpack configuration file. This file contains all the settings for the webpack module bundler. We use webpack to compile all the files in the modules folder to the bundle.js and bundle.css that are found in the viewer-assets folder. |
File / Folder |
Description |
viewer-assets folder |
Contains the essential JavaScript, CSS, fonts, images, language data, and templates (HTML) that make up the book reader Viewing Client. |
modules folder |
Contains uncompiled assets of the Viewing Client. These files will be compiled to viewer-assets/js/bundle.js and viewer-assets/css/bundle.css by the build process defined in Gulpfile.js. The files in this folder are non-essential and do not need to be re-distributed. |
Gulpfile.js |
Contains Gulp tasks to build the viewer js and css files. This file is non-essential and does not need to be re-distributed. |
viewer-assets/package.json |
A file used by npm (a package manager). It defines the dependencies installed by npm, which are required to run Gulp and compile the Viewing Client assets.This file is non-essential and does not need to be re-distributed. |
viewer-webtier folder |
Contains files that implement the php layer of communication between the book reader Viewing Client and the PrizmDoc Application Services. |
viewer-webtier/pas.php |
Handles all requests from the Viewing Client and forwards them to the PrizmDoc Application Services. |
viewer-webtier/pcc.config |
Defines the connection settings for the PrizmDoc Application Services. |
viewer-webtier/PccViewer/Config.php |
This class parses the pcc.config file and provides methods for easily reading its parameters. |
index.html |
The default page for the sample. This page loads the Viewing Client. |
.htaccess |
Contains Apache web server settings. |
webpack.config.js |
Webpack configuration file. This file contains all the settings for the webpack module bundler. We use webpack to compile all the files in the modules folder to the bundle.js and bundle.css that are found in the viewer-assets folder. |
The file pcc.config is used to configure the connection settings between the web tier and PrizmDoc Application Services. The file can be found at: <sample-folder-name>/viewer-webtier/pcc.config. This file is self-documenting, but a little information about the configuration options is given below.
<DocumentPath> (Only in splash pages) |
The sample pulls named documents from this location. The DocumentPath must have read/write permissions in order for the file drag and drop functionality of the splash page to work. |
<PrizmApplicationServices[Scheme|Host|Port]> |
Specifies how to connect to the PrizmDoc Application Services |