Since a lot of PHP projects use MySQL (MariaDB) as database software, ExeOutput for PHP provides you with the ability to include a portable MySQL server (which is MariaDB) along your compiled PHP application. The MySQL server is considered as portable because it doesn’t require to be installed as a Windows service in order to work. This behavior is similar to what you can find in “WAMP” distributions, except that we don’t use Apache nor PHP software because they are replaced by ExeOutput for PHP.
ExeOutput for PHP will use a portable MySQL server that is provided by the open-source MariaDB project.
The ExeOutput for PHP’s main distribution does not include the portable MariaDB server: use the Web Update utility to download and install the package. Just click the “Check for updates” icon in ExeOutput for PHP to launch the Web Update utility. Then tick “MySQL package for ExeOutput for PHP” and the package will be automatically installed for you.
Once the MySQL package for ExeOutput for PHP is installed, files that will be used for each project are stored in the
MySQL\Source\mysql subfolder of the ExeOutput for PHP’s main installation folder. Of course, you can update them manually if you want.
First, you must have defined the folder where your application EXE file will be created (Output Path). All files required by the MySQL portable server will be copied into a “MySQL” subfolder.
This subfolder must always be placed in the same folder as the application EXE output file, so you must include this entire folder when you distribute your application or create an installer with Paquet Builder for instance.
When you click this button, you will be prompted for two settings: the root password and the connection port (the TCP/IP port number to use for the connection. The default is
Then, all files required by the MySQL portable server are copied to the “MySQL” subfolder and the server is started. ExeOutput for PHP will ask you to click OK when the server is ready and listening.
Finally, ExeOutput for PHP shutdowns the server. The latter is now ready for use with your application.
Do not change the root password yourself. ExeOutput for PHP remembers the root password so that it can shutdown the server when the application closes. If you have to change it, repeat the steps above.
If you want to remember which root password and connection port you used, just click the appropriate links in ExeOutput for PHP named
Show configured username and password, and
Show configured port.
The MySQL server used comes from a vanilla distribution. Except the root password, nothing else is modified: you must then configure settings yourself (thanks to the
my.ini configuration file in the “mysql” subfolder).
To manage databases of the portable MySQL server, use a MySQL client: some MySQL clients exist in PHP such as phpmyadmin or Adminer.
We compiled Adminer with ExeOutput for PHP into Adminer EXE so that you can run Adminer EXE without requiring any local PHP installation nor WAMP distribution. Furthermore, to help you administer your portable MySQL server, ExeOutput for PHP can place a temporary copy of Adminer EXE in the same folder as your output EXE file and run it. Thus, Adminer will automatically start the portable MySQL server of your PHP application and let you run SQL commands, manage databases and so on. When you close Adminer EXE, the portable MySQL server is also shut down.
If you changed the connection port, enter
localhost:[newport] in the server field.
The username is
root by default and the password is the root password you defined in a previous step.
Before distributing your PHP application, remove the Adminer EXE tool from the folder or ignore it.
The ExeOutput for PHP’s main distribution does not include the Adminer EXE tool: you must download and install the package yourself thanks to the Web Update utility. Just click the “Check for updates” icon in ExeOutput for PHP to launch the Web Update utility. Then tick “Adminer package for ExeOutput for PHP” and the package will be automatically installed for you.
First, be sure to enable the
MySQLi PHP extension so that your PHP application can handle MySQL: go to the “PHP Settings -> PHP Extensions” page in ExeOutput for PHP. Then, you can configure your application to automatically start the MySQL server when it is run, and stop it when the application exits: tick Start and stop the MySQL server automatically.
If the server cannot be started for some reason, an error is displayed at startup. You can customize the error message thanks to the Localization tab.
Only one instance of the server can be run at a time: we then recommend that you do the same with your application. Go to Security / Global Options and tick
Only one instance of the application can be run at a time.
The PHP application always expects to find the portable server in the “
MySQL” subfolder of the application EXE’s location.
To remove the portable MySQL server, untick Start and stop the MySQL server automatically and then you can erase the “
MySQL” subfolder of the application EXE’s location. That’s enough.
To prove that ExeOutput for PHP can work with MySQL-based apps, we successfully compiled the famous WordPress app into a portable desktop application. The sample comes with full source and a tutorial! Do not hesitate to check it out.
Copyright G.D.G. Software 2018. All Rights Reserved.