Go Back to Help Index

Adding a Step: Custom PHP

Purpose

BuildExec is very modular and powerful yet some developers may still want to execute custom PHP code during the installation.  This step accepts any PHP code and even allows for use of previous user-entered data from the Configuration File Generator step.

Field Breakdown

Step Name - This title will be displayed at the top of this screen during the installation process.

Description - In the content area of the installation screen, this text will be displayed.  The results of the PHP code will follow this description.  You must format using HTML.  For newlines, you should use '<br />' for HTML breaks.

PHP Code - Just as in other steps, you may use data which the user entered during the Configuration File Generator step in your code.  For your ease, we have included this data in an array called $tempconfig.  Each key in this array is the name of the field and it's corresponding value is the data that the user entered for the field.  For example, $tempconfig['Database Username'] may equal 'dbusername'.  Below is an example of the PHP Code field using this $tempconfig array.

// Remember, we cannot have <?php or ?> because that will break the script!

// We have a Field in the Configuration File Generator called 'Username',
// let's output the username!

echo 'The username you entered is: ' . $tempconfig['Username'] . '.';

 

Frequently Asked Questions

Why can we not have <?php or ?> in our PHP Code?

Your code is inserted into another PHP file so having <?php or ?> would break the script.