Skip to content

Working with PHP

ExeOutput for PHP™ integrates the entire PHP runtime into your application and lets you completely customize it.

About PHP implementation in ExeOutput for PHP

Starting from version 2, ExeOutput for PHP uses PHP CGI directly as an external process. This brings several advantages:

  • PHP is separated from the UI process, giving more stability and responsiveness.
  • If the PHP process crashes, a new one is started if you refresh the webpage. Your application itself doesn’t crash.
  • ExeOutput for PHP supports different PHP versions from PHP 5.6 to the latest versions 8.x. You can choose the PHP version you want.
  • Full integration between PHP and Chromium rendering engine. AJAX, cookies, file upload and download dialog boxes, custom request and response HTTP headers, Developer Tools are supported.

Note

For console applications, PHP CLI is used instead of PHP CGI.

If your PHP code uses PHP extensions, include them in your application

If your PHP website requires extensions, you should first configure them in the PHP Extensions page.

Tip

ExeOutput for PHP can embed PHP extensions into the EXE file so you don't have to deploy them manually.

Where are PHP files located at runtime?

ExeOutput for PHP uses virtualization: all PHP files are stored in memory (optionally encoded to avoid memory dumps)and the PHP runtime is led to believe that they are located on the hard disk.

Basically, your PHP app will use a "Data" subfolder where it will place its PHP files. By default, this "Data" virtual subfolder is placed in the folder where the EXE is located. If the path to your EXE file is e:\my folder\myprogram.exe, the path to the "Data" subfolder will be e:\my folder\data. You can even choose the virtual folder yourself and provide one that does not exist!

It is even possible to place real files into this "Data" subfolder. For instance, if you decide to keep some files outside your EXE (they are named External Files), your PHP app can still recognize them.

If the EXE is also placed in a folder that can be written to (such as My Documents or the local user's AppData folder), you can also write files to that "Data" subfolder.

To get the path to that "Data" subfolder, just use $_SERVER['DOCUMENT_ROOT'].

For instance, to read a file into the "Data" subfolder, you can use this:

<?php 
$cont = file_get_contents($_SERVER['DOCUMENT_ROOT'].'\\include1.txt', FILE_USE_INCLUDE_PATH);
print($cont);
?>

Custom PHP.INI

You can tweak PHP parameters directly with the built-in PHP.INI editor.

Warning

Do not place your own PHP.INI in the root folder. Use the editor of ExeOutput for PHP.

Advice for getting started with PHP applications in ExeOutput for PHP

How compiled PHP applications work