nativeInstallerwamp

Create a custom PHP application

Many users run a Bitnami stack as a development environment for their own PHP projects (as opposed to running third-party applications such as Joomla! or WordPress). To deploy your PHP application in this environment, you have two options:

  • To make a single PHP application accessible at the root URL of the Web server (for example, http://localhost), simply copy the PHP files into the installdir/apache2/htdocs folder. For an example, take a look at the phpinfo example.

  • To have several applications running, create the same structure used by Bitnami when installing Bitnami PHP applications. Recent versions of Bitnami stacks ship a demo application with this structure to help you get started. To use this, follow the steps below:

    • Launch an elevated Windows command prompt.

    • Copy the installdir/docs/demo folder into the installdir/apps directory.

      $ copy installdir/docs/demo installdir/apps
      
    • Add the following line to the end of the installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf file:

      Include "installdir/apps/demo/conf/httpd-prefix.conf"
      
    • Restart the Apache server using the graphical manager tool.

      Server control

    You should now be able to access the demo application at http://localhost/demo. You should see a “Hello world” message in your browser.

  • If your stack does not include a demo application, or if you prefer to create a custom PHP application from scratch, follow the steps below. These steps assume that your application will live in the installdir/apps/myapp/ directory:

    • Launch an elevated Windows command prompt.

    • Run the following commands to create the directories:

      $ mkdir installdir/apps/myapp
      $ mkdir installdir/apps/myapp/htdocs/
      $ mkdir installdir/apps/myapp/conf
      
    • Create and edit the installdir/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:

      Alias /myapp/ "installdir/apps/myapp/htdocs/"
      Alias /myapp "installdir/apps/myapp/htdocs/"
      Include "installdir/apps/myapp/conf/httpd-app.conf"
      
    • Create and edit the installdir/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application’s requirements.

      <Directory installdir/apps/myapp/htdocs/>
          Options +FollowSymLinks
          AllowOverride None
          <IfVersion < 2.3 >
          Order allow,deny
          Allow from all
          </IfVersion>
          <IfVersion >= 2.3>
          Require all granted
          </IfVersion>
      </Directory>
      

      NOTE: If your application uses .htaccess files, you should move the configuration in the .htaccess files to the main application configuration files and set the AllowOverride option to None. Find out how to move the .htaccess file content to the main server configuration file and refer to this Apache note for more information.

    • Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at installdir/apache2/conf/bitnami/bitnami-apps-prefix.conf, as shown below:

      Include "installdir/apps/myapp/conf/httpd-prefix.conf"
      
    • Restart the Apache server using the graphical manager tool.

      [![Server control](/images/img/platforms/installer/manager-windows.png)](/images/img/platforms/installer/manager-windows.png)
      

    You should now be able to access the application at http://localhost/myapp.

Check out the following tutorial if you want to learn more about configuring a custom PHP application.

Last modification September 6, 2019