Quantcast
Viewing latest article 6
Browse Latest Browse All 16

Putting together a local Apache server to run PHP scripts

I was going through Jasko Koyn’s OOP php tutorial (link) and needed a server to execute some of the php scripts. Here’s how I went about it, using Bitnami’s AMP stack.

The following instructions are from the Bitnami docs:

To add your PHP application to the Bitnami AMP Stack, you have two options:

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

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

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

b. 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"

Remember to substitute installdir with the actual installation directory of your Bitnami AMP Stack.

c. Restart the Apache server using either the graphical Manager tool or the command-line tool in your installation directory.

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

Step 1
Copy my directory folder, in this case, jasko_oop_php to the C:/Bitnami/wampstack-5.5.27-0/apps directory

Step 2
At the very end of the file bitnami-apps-prefix.conf, located in C:/Bitnami/wampstack-5.5.27-0/apache2/conf/bitnami/bitnami-apps-prefix.conf, add the following line:

Include "C:/Bitnami/wampstack-5.5.27-0/apps/jasko_php_oop/conf/httpd-prefix.conf"

Step 3
In the directory C:/Bitnami/wampstack-5.5.27-0/apps/jasko_php_oop/conf/, change the following files like so:

httpd-app.conf

<Directory "C:/Bitnami/wampstack-5.5.27-0/apps/jasko_php_oop/htdocs">
    Options Indexes MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
    Order allow,deny
    Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
    Require all granted
    </IfVersion>
</Directory>

httpd-prefix.conf

Alias /jasko_php_oop/ "C:/Bitnami/wampstack-5.5.27-0/apps/jasko_php_oop/htdocs/"
Alias /jasko_php_oop "C:/Bitnami/wampstack-5.5.27-0/apps/jasko_php_oop/htdocs"

Include "C:/Bitnami/wampstack-5.5.27-0/apps/jasko_php_oop/conf/httpd-app.conf"

httpd-vhosts.conf

<VirtualHost *:81>
  ServerName www.jasko_php_oop.com
  DocumentRoot "C:\Bitnami\wampstack-5.5.27-0/apps/jasko_php_oop/htdocs"
  Include "C:\Bitnami\wampstack-5.5.27-0/apps/jasko_php_oop/conf/httpd-app.conf"
</VirtualHost>

Step 4
Restart the Apache server

Step 5
Access the php scripts by going to localhost:81/jasko_php_oop/index.php

DONE!


Viewing latest article 6
Browse Latest Browse All 16

Trending Articles