Skip to content

Working with PHP

ExeOutput for PHP™ integrates the entire PHP runtime into your application, allowing for complete customization.

About PHP Implementation in ExeOutput for PHP

Since version 2, ExeOutput for PHP utilizes PHP CGI as an external process. This approach offers several benefits:

  • Enhanced Stability and Responsiveness: By isolating PHP from the UI process, your application becomes more stable and responsive.
  • Automatic Recovery: If the PHP process crashes, it will automatically restart when you refresh the webpage, ensuring that your application remains running smoothly.
  • Flexible PHP Version Support: ExeOutput for PHP supports a wide range of PHP versions, from PHP 5.6 up to the latest PHP 8.x releases. You can select your preferred PHP version.
  • Seamless Chromium Integration: Enjoy full integration between PHP and the Chromium rendering engine, with support for AJAX, cookies, file upload and download dialogs, custom HTTP request and response headers, and Developer Tools.

Note

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

Including PHP Extensions in Your Application

If your PHP application requires extensions, you should first configure them on the PHP Extensions page.

Tip

ExeOutput for PHP can embed PHP extensions directly into the EXE file, eliminating the need for manual deployment.

Where Are PHP Files Located at Runtime?

ExeOutput for PHP employs virtualization: all PHP files are stored in memory (optionally encoded to prevent memory dumps), while the PHP runtime is made to believe that they are located on the hard disk.

Essentially, your PHP application will use a "Data" subfolder to store its PHP files. By default, this "Data" virtual subfolder is located in the same directory as the EXE file. For example, if your EXE file is located at e:\my folder\myprogram.exe, the path to the "Data" subfolder will be e:\my folder\data. You can even specify a custom virtual folder that does not physically exist on the disk!

You can also place actual files into this "Data" subfolder. For instance, if you choose to keep some files outside your EXE (referred to as External Files), your PHP application can still access them.

If the EXE is located in a writable directory (such as My Documents or the local user's AppData folder), you can write files to the "Data" subfolder.

To retrieve the path to the "Data" subfolder, simply use $_SERVER['DOCUMENT_ROOT'].

For example, to read a file in the "Data" subfolder, you can use the following code:

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

Custom PHP.INI

You can adjust PHP parameters directly using the built-in PHP.INI editor.

Warning

Do not place a custom PHP.INI file in the root folder. Instead, use the ExeOutput for PHP editor.

Advice for Getting Started with PHP Applications in ExeOutput for PHP

How Compiled PHP Applications Work