Deploying Code with Zend Server

This procedure describes how to deploy your PHP code to run with Zend Server.

Note:

For information on deploying applications with Zend Server, see Working with Applications.

Zend Server provides all the components for creating an environment suitable for developing and deploying PHP applications.To run a PHP Application you need a Web server. Apache is bundled by default with Zend Server and is used to run your PHP code. This option may vary depending on your operating system. For instance, for Linux, Zend Server uses the distribution's Apache and for Windows and MAC OS X, Apache Web server is bundled with the Zend Server installation.

Note:

If you are using Windows OS, please note that the Zend Server Deployment feature is not available for IIS.

The process of writing PHP applications is separated into two distinct sections: Development and Production.

  • Development includes developing and debugging your code. In most cases, this is done on a developer's machine or on a remote server with limited or password-protected access.
  • Production is when the Web application has reached a level of maturity that allows it to be exposed to its target audience. The only tasks that should be done are debugging (remote) and uploading changes. It is against best practices to make changes to code running on a Production server and the preferred method is to use FTP/SFTP to upload changes.

Development

Where to Put the Code?

In order to run a PHP application, your PHP files must be placed in a specific location that indicates to the Web server what files to service.

When you are ready to run your PHP code on a Web server, place the files under the following directory according to your operating system and preferences:

IBM i:

  • /www/zendsvr6/htdocs

Running the Code/Application

Open a browser and enter the URL: http://localhost:10080 /<yourPHPfile>.php

Replace <yourPHPfile>.php with name of the file you want to access/run.

Note:

Remember to use the port name according to the port number you defined.

To find out how to locally debug your code once it's deployed in a Web server, see Working with Local Debugging.

Production

Deploying code to production is different than running your application in a controlled environment (such as a local server). Production means publishing your application to the internet.

 

So where do you publish your application?

Depending on the resources available to you, you either have a different server that is dedicated to servicing the web or a cluster of servers that are managed with a load balancer. In both cases, a firewall or some other protection is necessary.

An additional option is to have your application run from a Web Hosting company.

 

Once your code is in its dedicated location, you will have to support the code so you will need to establish a way to upload files for purposes of issuing updates and fixing bugs or security threats. At this point if you have been locally debugging your code with Zend Studio you can now change your settings to remote debugging, if there is a firewall between you and your application's files you will need to use tunneling in order to debug through a firewall. Zend Studio users can also benefit from Remote Server support for uploading and synchronize your code.