CodeCharge Studio

Deploying PHP Applications

The process of deploying PHP projects is relatively straight forward provided that there is a properly configured server where the pages will be published. A server such as Apache or IIS, which has the PHP engine installed, is capable of serving ordinary PHP pages that have been placed within the server root. In some cases, the PHP engine needs to have extensions installed or activated. For instance, if you use an Oracle database the PHP engine should have been compiled with Oracle support or the PHP.ini file should be configured to enable Oracle support.

Another issue that often comes up with PHP is the use of session variables. The security mechanism implemented by CodeCharge Studio makes use of session variables to store user information. Session variables must be properly configured and working on the server if the project implements security.

The PHP.ini file specifies the location where the session variable files are stored. This is in a variable called session_save_path. Make sure that this variable refers to a valid folder or the server will not be able to create session variables.

If you are using a remote host, which means that you do not have access to the PHP.ini file, you can ask your host if they allow user defined .htaccess files. In an Apache server, a .htaccess file placed in the users directory can be used to override the default properties configured in files such as the PHP.ini file. For more information about these files, please refer to the Apache documentation.

When deploying a PHP project the server-side database connection is always different from the design-time database connection. This is unlike ASP and .Net where the server and design connections can be the same. This means that in all projects you have to configure the server side connection before publishing.

The server-side database connections in PHP are implemented using database libraries. Each library contains code that encapsulates the functions needed to carry out database operations. Currently, there are libraries for Interbase, mSQL, MySQL, Improved MySQL, ODBC, Oracle, Oracle OCI, PostgreSQL, SQL Server, SQL Anywhere and Sybase.

If the database that you intend to use is not among the list find out if there is an ODBC driver for the database so that you can connect to the database through ODBC. For instance, if you intend to use a Microsoft Access database you could create an ODBC DSN for the database then configure the server-side connection to connect through ODBC. Of course, a Microsoft Access database can only be located on a Windows machines so this precludes deploying the database on a different platform other than Windows.

Most of the database connections in PHP require you to specify login details (e.g., username and password). For instance, a connection to a MySQL database must have a username and password specified.

Along with the authentication details, a PHP connection typically requires you to specify the location of the machine where the database is located. This value is entered in the Host parameter. If the database is located in the same machine as the PHP pages you can simply enter localhost.  If the database is not located in the same machine you need to specify the IP address or domain address of the machine where the database is located. \

In CodeCharge Studio 5 added PHP MySQL Native Connection


On-line, printable versions and updates