Table of contents
In this guide you can find how to add your own PHP application on top of the LAMP/MAMP/WAMP Stack or any Virtual Machine or AMI.
How to create the basic application structure?
All PHP application are configured in a similar way in BitNami. The following folders are into your installation directory or in "/opt/bitnami" if you are using the Virtual Machines or AMIs. This is the basic structure folder:
- apps/ This is the folder where are all the PHP applications (for example: apps/phpmyadmin, apps/wordpress, etc). In this guide we will use "myapp" name for the folder.
- apps/myapp |- htdocs |- conf |- data (optional)
On Windows: You can create the folders manually
On OS X: On Linux: You can run the following commands:
$ mkdir /installdir/apps/myapp $ mkdir /installdir/apps/myapp/htdocs $ mkdir /installdir/apps/myapp/htdocs/conf
- apps/myapp/htdocs In this folder you can find the PHP application files. This is where you should copy the application files or your PHP files.
On Linux: You can uncompress the application code into this folder. You can find below two examples for uncompressing a ".zip" file or a ".tar.gz" file:
$ tar -xzvf myapp.tar.gz -C /installdir/apps/myapp/htdocs $ unzip myapp.zip -d /installdir/apps/myapp/htdocs
- apps/myapp/conf/myapp.conf This is the Apache configuration file and the content could be different depending on the application. The basic approach is the following.
Alias /myapp/ "/installdir/apps/myapp/htdocs/" Alias /myapp "/installdir/apps/myapp/htdocs" <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>
(If you are using the Virtual Machine or the AMI, remind that "your_installdir" is /opt/bitnami).
If your application uses .htaccess files, you should change the "AllowOverride None" option with "AllowOverride All". Check this note to move the .htaccess file to the main configuration.
Once you have these files, you should add the following line at the bottom of the Apache configuration file "/your_installdir/apache2/conf/httpd.conf".
... Include "/installdir/apps/myapp/conf/myapp.conf"
Then, restart the Apache server and you can access to your application at http://your_domain/myapp
sudo /installdir/ctlscript.sh restart apache