When your application is done, you want to run in a real life situation. That will be a separate server, outside your development environment, usually a server that runs a separate webserver and database. So you need to deploy your application. To be able to you need to follow the following procedure:


Purge your local deploy environment as described in the previous chapter

This will prevent orphan files and unnecessary security risks.


Deploy the images of your project

While you are developing you have to manually deploy your images. This is implemented this way as you only need to deploy the images once. But while developing, you might have changed icons, images and this will remove all unused images.


Do NOT use the Run Time button 

PHsPeed has the ability to use a private runtime library. This is beyond the purpose of this courseware.


Promote your code for production

To be able to debug your code, PHsPeed adds code to your project to make this possible. Promoting code for production will remove this code from your sources, and also removes remarks, empty lines etc. to make your code smaller and faster. After all, the code will run in a separate environment. The Shared Runtime is also promoted. 


Create a database config file. 

It is very likely that the database of the environment where you deploy your application has different credentials. PHsPeed makes use of an encrypted config file that contains this information. There are several ways to create this file, but the DBConfig allows to create a file that can be deployed with your application. The other ways (like external logons as Saml, Ldap, or a configuration program to create the file dynamically, will be discussed in other courseware.).


To create the config file go to Database -> Connection/PDO, and on the connection screen choose Create Production DBConfig File. Other option is to use the DBConfig button on the toolbar that you find under the tab Deployment.



This will open the config setup:



The key and vector are set by default from the project options. When you click 'Apply' the config file is created in the project.


Promote the code for production.


This step is required to strip the code from debugging code, comments, empty lines, but it also prepares your database connection for production. While developing the properties of the connection component is used. But these properties are not allowed in a production environment. 



Do not enter anything in the PWA root folder. This is only required if you create a Progressive Web Application ('a web application that behaves like an 'app''). Click on start. PHsPeed will process all files including the runtime. When done, you are ready to upload your project.


If you setup a database user in your development environment then you can test locally if the application works. Otherwise you need to upload first and then start your main application.


Note: This step is required for your first upload to your acceptance environment, if you have one. It is not uncommon to have end users test your application before you put it into production. As the production environment is a copy of your acceptance environment you can copy the folder or do a new upload. It is always possible to use the IDE to generate a new database config file for your production server is the database has different credentials for acceptance and production.