ExeOutput for PHP
  • Discover
    Homepage
    Our Latest News and Articles

    Keep up-to-date with the latest developments, insightful articles.

    Why a PHP Compiler?

    Reasons for using our PHP compiler ExeOutput for PHP.

    Screenshots

    Get a visual tour of our software through various screenshots.

    Video and Screencasts

    Access a range of video content, from detailed tutorials to product demos.

  • Feature Tour
    All-in-one PHP to EXE Compiler
    Use PHP power to create Windows apps
    Full HTML5, JavaScript and CSS3 Support
    Make GUI And Console Apps with PHP
  • Downloads
    Get ExeOutput for PHP

    Download the installer of our PHP to EXE compiler

    PHP App Examples

    Download sample apps made with ExeOutput for PHP

    WordPress Desktop App

    Download the stand-alone WordPress app sample

  • Buy Now
  • Learn
    Documentation

    Full online documentation of ExeOutput for PHP

    PHP App Samples

    Example projects made with ExeOutput for PHP for various cases

    ChangeLog

    Version history and releases of ExeOutput for PHP

    Privacy Policy

    See our Privacy Policy for ExeOutput for PHP

    About Us

    More information about G.D.G. Software

  • Support
    Contact Us

    Contact our staff or open a support ticket

    Newsletter

    Stay Updated: subscribe to our newsletter

    Frequently Asked Questions

    Find your answer directly in our FAQ

    Support Center

    Get direct support for ExeOutput for PHP

    Affiliate Program

    Join our affiliate program to promote ExeOutput and earn money

    Community Forum

    Visit our support forum and ask your questions

Try For Free
My Account

Getting Started

11
  • Welcome to ExeOutput for PHP
  • Getting Started
  • Starting a New Project
  • Advice for Getting Started with PHP Applications
  • How to Compile Your Project
  • How Compiled PHP GUI Applications Work
  • How Compiled PHP Console Applications (CLI) Work
  • Using PHP Frameworks
  • Visual C++ Redistributable Requirement
  • Application Command Line Switches
  • PHP Samples

Working With PHP

12
  • Working with PHP
  • Choose a PHP Version
  • Accessing Files in Compiled PHP Applications
  • Saving Files with PHP in Desktop Applications
  • Solving PHP Errors
  • Using the Save As Dialog Box in PHP Applications
  • Selecting Local Files with PHP (File Upload Replacement)
  • Built-In ExeOutput for PHP Functions
  • About PHP Sessions and Cookies
  • Global Variables
  • Using the cURL Extension
  • Using exec(), system() in Applications

Databases

4
  • Using Databases in Applications
  • MySQL and MariaDB Support
  • Using a Portable MySQL (MariaDB) Server
  • How to Check MySQL Server Connection

JavaScript And Browser

14
  • JavaScript and the Chromium Browser
  • Developer Tools in ExeOutput Applications
  • The exeoutput JavaScript Object API
  • JavaScript window extension
  • Special Protocols for Links
  • HTML5 and CSS3 Support
  • Using HTML5 Video and Audio
  • Print, Kiosk Printing, and PDF
  • Opening New Windows
  • JavaScript window extension
  • Using Flash Objects (SWF) in Compiled Applications
  • Adding Custom Headers to Requests
  • How to Configure Proxy for Your App
  • HTTP Basic Authentication

File Manager

4
  • File Manager
  • File Properties Editor
  • About External Files
  • Internal Code Editor

Application Settings

9
  • Choosing and Configuring the Rendering Engine
  • Chromium Embedded Framework (CEF) Settings
  • WebView2 Rendering Engine Settings
  • Main Window Settings
  • UI Skin Properties
  • Application Components
  • Language and Localization
  • Startup and Exit Messages
  • Application Settings – Dialog Boxes

PHP Settings

7
  • PHP Settings – Main Settings
  • PHP Settings – PHP Extensions
  • PHP.ini Settings
  • PHP Settings – String Protection
  • PHP Settings – PHP Debugging
  • PHP Settings – External HTTP Server
  • Redirection and Routing

User Interface

13
  • User Interface Components
  • User Interface Editor
  • UI Control Actions
  • How to Modify Controls at Runtime
  • Status Bar Properties
  • Printer Properties
  • Tray Icon Properties
  • Context Menu Properties
  • Creating a Ribbon for Your Application
  • Toolbars in Your PHP Application
  • Menu Bar in your PHP application
  • Adding an Image or Logo to the UI
  • Using Timers and Cron Jobs in Your Application

Security

4
  • Security – Global Protection
  • Security – PHP Protection
  • Security – Code Signing (Digital Signatures)
  • Security – Licensing

Application Output

5
  • Application Output Settings
  • Output – Deployment Options
  • Application Loading Screens
  • Output – EXE Icon and Version Information
  • Output – Creating Installers or Zip Archives

Scripting with HEScript

9
  • Introduction to Scripting with HEScript
  • The HEScript Editor
  • Adding HEScript Code to Your Application
  • Script Templates
  • Running and Calling HEScript Procedures/Functions
  • HEScript Function Reference
  • How to Run an Executable Program
  • How to Prompt a User for Their Name Once and Store It
  • How to Call DLL Functions

Additional Information

6
  • Environment Options
  • Technical Notes Regarding Applications
  • Cloning a Project
  • Command Line Options
  • Contact Information
  • About this documentation
View Categories
  • Home
  • ExeOutput for PHP Help
  • Working With PHP
  • Accessing Files in Compiled PHP Applications

Accessing Files in Compiled PHP Applications

4 min read

Applications created with ExeOutput for PHP are not designed to function like a web server. You may need to adjust your PHP code to create or access files on the user’s computer, or files compiled into your application’s EXE file, which are listed in the File Manager.

Tip

Please refer to the Accessing Files topic of the General Demonstration for live demonstrations and further explanations about working with local files from your ExeOutput for PHP apps.

Accessing Local Files #

By default, PHP scripts in your application can access any local file on the user’s computer. Absolute paths should be used. See below for how to access files shipped with your application or compiled into it.

Accessing Source Files from the Internal Browser #

Your application functions as if it were server software, serving webpages and related files through the HTTP protocol. When the application runs, it creates a custom pluggable protocol (similar to HTTP, FTP, etc.) to communicate with the Chromium rendering engine. In other words, the application works like a small server combined with a client (the main window that allows users to navigate HTML and PHP pages). Your website is then available as if it were on a server, but without requiring an internet connection or a physical server.

Tip

The internal browser can read files from the storage location only if URLs begin with the base URL followed by the virtual path to the file.

The base URL depends on the selected rendering engine:

  • For the CEF engine, the base URL is https://heserver/.
  • For the WebView2 engine, the base URL is https://heserver.example/ to ensure proper cookie handling.

For instance, to access a page named index.html with the CEF engine, you would use the URL https://heserver/index.html.

When your application starts, the browser automatically navigates to your index page.

Accessing External Files from the Internal Browser #

Your application can automatically load external resource files (not compiled into the EXE). For instance, you can keep image and media files outside the EXE file (in the same folder or a subfolder).

Examples:

  • If an HTML file references image1.png, the application will look for the image1.png file in its compiled data. If not found, it will try to locate and load it from the same folder as the EXE file (depending on the URI).

  • If you have an image file in a subfolder, e.g., <img src="myfolder/my image.png" />, the application will expect the “my image.png” file to be in a subfolder named “myfolder” (if you leave the file external).

Note

External files must be deployed with the application’s EXE file in their respective folders.

Accessing Source Files from PHP #

ExeOutput for PHP leads the PHP runtime to believe that PHP scripts and other compiled files are on the hard disk in a Data subfolder, when they are actually held in virtual memory.

For instance, 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 think of the Data subfolder as playing the same role as the www folder in Apache.

Tip

The DOCUMENT_ROOT server variable contains the full path to the virtual Data folder.

Info

You can also keep PHP files outside the EXE and place them directly into a physical Data subfolder (see below).

For security reasons, you may want to choose a custom name for the virtual Data folder. The ExeOutput for PHP virtualization engine allows you to choose any virtual folder, even one on a non-existent drive. To activate this feature, go to “PHP Settings” => “Main Settings” and enable “Use an absolute path for the virtual “Data” subfolder“. Then, enter the path of your choice, for instance, X:\Data.

Troubleshooting “file missing” Errors #

Generally, ExeOutput for PHP intercepts all files requested by the PHP runtime and makes them available. For instance, ExeOutput for PHP supports include, require, include_once, and require_once.

Warning

PHP’s fopen function cannot download and open files from URLs beginning with http://heserver/, as no real web server is used.

If PHP displays “missing file” errors or warnings such as “php failed to open stream“, you may need to mark files in the File Manager (select your files, click File Properties, and turn on the Unpack the file(s) to virtual memory at startup option) or use the ExeOutput-specific PHP function named exeoutput_unpackvirtualfile.

string exo_unpackvirtualfile ( string $sourcepath , string $optionaldestpath )
  • $sourcepath is the virtual source path to the compiled file you want to unpack to memory.
  • $optionaldestpath is the absolute path to the destination virtual file. If you leave it blank, the path is constructed from $_SERVER['DOCUMENT_ROOT'] and the virtual path.

The function returns the absolute path to the virtual file in UTF-8 format. This path can be used with PHP functions like fopen, file_exists, and file_get_contents.

Example: The following script makes demo1.pdf available and displays its full (virtual) path and size:

<?php 
$filename = exo_unpackvirtualfile('res\demo1.pdf', '');
echo $filename . ': ' . filesize($filename) . ' bytes';
?>

Accessing External Files from PHP Scripts #

You can create a physical Data subfolder to place any external or resource files that your application or PHP scripts require, such as database files, XML, etc. Even PHP files can be placed in this folder and used in conjunction with the PHP scripts compiled into your application.

We recommend using the “External Files” feature of ExeOutput for PHP to manage external files automatically.

Important

External files must be deployed with the application’s EXE file in the Data subfolder.

Warning

If the “Use an absolute path for the virtual “Data” subfolder” option (“PHP Settings” => “Main Settings”) is enabled, you will not be able to access real files that you may have placed in a physical Data subfolder.

For instance, if you have a file named include1.txt in the Data folder, the following script will display its contents:

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

About is_file and is_dir #

The standard PHP functions is_file and is_dir have been modified to handle virtual files and folders. They will return true if you check for the existence of a virtual file (even if it is not yet in memory) or a virtual folder.

How to create and save files with PHP

How compiled PHP applications work

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Choose a PHP VersionSaving Files with PHP in Desktop Applications

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • Accessing Local Files
  • Accessing Source Files from the Internal Browser
  • Accessing External Files from the Internal Browser
  • Accessing Source Files from PHP
  • Troubleshooting "file missing" Errors
  • Accessing External Files from PHP Scripts
  • About is_file and is_dir
ExeOutput for PHP to EXE compiler

PHP to EXE App Compiler
© G.D.G. Software 2025

X-twitter Youtube
Software
  • Home
  • Feature Tour
  • Screenshots
  • Video and Screencasts
  • Home
  • Feature Tour
  • Screenshots
  • Video and Screencasts
Get
  • Download
  • Buy Now
  • PHP App Samples
  • My Account
  • Download
  • Buy Now
  • PHP App Samples
  • My Account
Connect
  • Latest News
  • Newsletter
  • Forum
  • Affiliate Program
  • Support Center
  • Latest News
  • Newsletter
  • Forum
  • Affiliate Program
  • Support Center
QUESTIONS?
  • Contact Us
  • FAQ
  • Documentation
  • Privacy Policy
  • About Us
  • Contact Us
  • FAQ
  • Documentation
  • Privacy Policy
  • About Us
Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}