PHP-GTK2 Newsletter

PHP-GTK2 Tips & Techniques
FREE Newsletter
by kksou




Compiling standalone PHP-GTK2 applications on windows using PriadoBlender
Written by kksou   
Monday, 21 July 2008

This article contains step-by-step instructions on how to set up and compile standalone PHP-GTK2 applications into .exe files on windows using PriadoBlender.

Interestingly, installing PriadoBlender and compiling the PHP-GTK2 apps is the easy part. The "tricky" part is how to distribute and run the compiled .exe.

Important Note: For now, PriadoBlender only works with the Gnope version of PHP-GTK (which is running PHP-GTK2 alpha version with PHP v5.1.4 and GTK+ v2.6.9). I'm sure the author of PriadoBlender will upgrade the program soon to work with PHP-GTK v2.0.


Installing PriadoBlender

  1. Download PriadoBlender-2.0 BETA.zip. Note that this zip file is huge, about 23.1MB.
  2. Unzip the file anywhere you like. You will see a folder called "PriadoBlender".
  3. That's it! You're now ready to run PriadoBlender!

Using PriadoBlender

  1. Go to the folder where you have unzipped PriadoBlender.
  2. From the root directory of PriadoBlender, you will see a folder called bin. Open this folder. You will see a file called main.exe. Make a backup copy of this file. You can just click on the file, and then press Ctrl-C (Copy) followed by Ctrl-V (Paste).
  3. I'll explain more about why the need to do this later. For now, just go ahead and make a backup copy of this main.exe somewhere.

  4. Now double click the file PriadoBlender.exe (located in the root folder). You will see the following:
  5. Select "File - New Project" from the menu as shown below:
  6. Select your output name, input file and output folder. For Type of Project, select "PHP-GTK2". For Version of PHP, select "PHP5". When you're ready, click Compile!
  7. If everything goes fine, you will see the following message:
  8. Congratulations! You've successfully compiled your PHP-GTK2 application! Using the example above, you should now see the file sample-code-0033.exe in the output folder you have specified.
  9. Note that if you double-click on the .exe file now, most likely your program will start. However, I find that 9 out of 10 times, when you start clicking somewhere in the program, the program will quit. Please read on to see how to resolve this.

Distributing and Running the Compiled Application

This is the most "tricky" part so make sure you follow the steps.

PriadoBlender actually comes bundled with PHP-GTK2 alpha running on PHP v5.1.6 with GTK+ v2.6.9. However, I find that the bundled PHP-GTK2 doesn't run properly most of the time.

I found out that the compiled program works pretty well with the Gnope version of PHP-GTK2. The Gnope version is running PHP-GTK2 alpha with PHP v5.1.4 and GTK+ v2.6.9.

So assuming you're application runs fine with the Gnope version of PHP-GTK2, to distribute your application:

  1. Install a copy of the Gnope version of PHP-GTK2 on your machine. Note that it's fine to have the Gnope version co-exists with PHP-GTK v2.0 or v2.0.1.
  2. Make sure your application runs fine with the Gnope version of PHP-GTK2.
  3. Compile your PHP-GTK application as outlined above using PriadoBlender.
  4. Make a copy of the entire folder of the Gnope version of PHP-GTK2. Rename the duplicated folder. Let's suppose you have renamed it as app1.
  5. In the folder where you have compiled your application, using the example above, copy the file sample-code-0033.exe (i.e. your compiled application) and the folder bin into the folder app1 (i.e. the Gnope version of PHP-GTK2 which you have duplicated).
  6. That's it! The folder app1 is all you need to distribute your program. To run your application, double-click on sample-code-0033.exe (i.e. the compiled .exe file.) And, of course, you can use some installer application to package this folder into a setup.exe.

How to recompile your application

If you have successfully used PriadoBlender, I'm sure one of the immediate questions you'll ask is how to recompile the application?

When you first run PriadoBlender, the following screen appears:

But when you run it the second time, your compiled application will run.

So if you need to recompile your application, how do you do that?

This is the reason why I asked you to make a copy of the file main.exe in the folder bin above.

When PriadoBlender compiles your application, the compiled application will overwrite this file main.exe. To recompile your application, just copy back the original main.exe (make sure you rename it back to main.exe), and you will see the compile screen again!


User reviews   Average user ratings:    2.5   (from 3 users)
  1. José Franco
    October 18, 2008 6:28pm
    Error on generate application

    Man i follow all your steps and it always opens me PriadoBlender application, in the final on the project.
    Where the php source file must be ?

    Regards

  2. Burnt Okra
    March 16, 2009 3:40pm

    I take it this was a driveby post. They moved their site to a phpBB discussion board, then blocked anonymous users from reading or posting to the board. Pure marketing genius, that.

    Anyway, the program works fine for me. Maybe I can answer your questions.

  3. Travis Doke
    October 02, 2009 2:05pm
    Help me

    Whenever I double click on the PriadoBlender.exe nothing happens at all. The program does not start......help please?!!?

Note: You have to be a registered member to leave a comment. Free registration here.

Last Updated ( Monday, 21 July 2008 )
 
< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2009. kksou.com. All Rights Reserved