Question

I need help with what I thought was going to be simple local machine set up.

We have a php codeIgniter app on our staging and of course production servers. I have been making my edits on staging, testing, confirming then moving production. Looks like we'll be making some significant changes in the near term so I decided I'd move the staging code to my local machine so I can really hack away at it. As embarrassing as this is, I can't get this php app configured to run on my local machine to save my life. Now after more than a week of trying, I'm pasted embarrassed, into frustration and sliding into desperation. It's not like I haven't installed apps on my local machine before, but this one is killing me.

Some insight about this app. This is one supply requisition app that multiple clients have access to and course is regulated by the client account number.

Client "Ahh" types in [ahh.supplygrp.com] into their browser, url takes them to their login page, they log in and access all 'their' company related info. Client "Bee" types in [bee.supplygrp.com] into their browser, url takes them to their login page, they login and access all 'their' company related info and so on.

The Ahh and Bee are the acct_name, [see db schema attached]so the url goes to server, finds the app, looks in the db for Ahh or Bee, if found, appends the servername, opens that url which would be ahh.supplygrp.com, shows login page, successful login>> off you go.

I know I am tripping over the servername, virtual host, host file, config file rules. I am missing something and I don't know what. I have set a new install of easyphp5++ [WAMP] on my PC, verified it works with basic php page and a generic install of Codeigniter. I've also installed the app in question along with it's db.

Can anyone walk me thru what I need to do as it relates to the server, host file, config files, virtualhost configurations to get this app running on my local machine.

Config file, acct schema are attached for reference.

Much thanks in advance.

CREATE TABLE `supplyGrp_accts_tbl` (
  `id` int(5) NOT NULL auto_increment,
  `acct_name` varchar(128) NOT NULL,
  `acct_url` varchar(256) default NULL,
  `logo_url` varchar(256) default NULL,
  `created_by` int(10) default NULL,
  `created_date` datetime default NULL,
  `modified_by` int(10) default NULL,
  `modified_date` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;


<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
 *--------------------------------------------------------------------------
 * Settings - This file contains configuration parameters of application
 *--------------------------------------------------------------------------
 * @author The Dev Team
 * @created 2/12/2011
 * @version 1
 *--------------------------------------------------------------------------
 */

$svrEnv = getenv("SUPPLYGRP_ENV");

if($svrEnv == "PROD")
{
    //BASE URL
    $BASE_URL = "https://".$_SERVER['SERVER_NAME'];

    //DATABASE SETTINGS
    $DB_HOST = "localhost";
    $DB_USER = "supplygrp";
    $DB_PASSWORD = "mypasswrd";
    $DB_NAME = "supplygrp";

    //EMAIL SETTINGS
    $SEND_EMAILS = TRUE;
    $EMAIL_PROTOCOL = "SMTP";           //mail OR sendmail OR smtp
    //set smtp details
    $EMAIL_SMTP_HOST = "xxx.net";
    $EMAIL_SMTP_PORT = "25";
    $EMAIL_SMTP_AUTH_REQUIRED = FALSE;
    $EMAIL_SMTP_SECURE = "";            // '' OR ssl OR tls
    $EMAIL_SMTP_USERNAME = "";
    $EMAIL_SMTP_PASSWORD = "";

    //FILE UPLOAD SETTINGS
    $UPLOAD_DIRECTORY_PATH = "uploads/";
    $UPLOAD_DIRECTORY_FULL_PATH = "/sites/supplygrp/uploads/";
    $UPLOAD_LOGO_PATH = "logos/";
    $MAX_UPLOAD_SIZE = 10;              //In MB
    $MAX_UPLOAD_SIZE_PER_REQUEST = 10;  //In MB
}
elseif($svrEnv == "TEST")
{
    //BASE URL
    $BASE_URL = "http://".$_SERVER['SERVER_NAME'];

    //DATABASE SETTINGS
    $DB_HOST = "localhost";
    $DB_USER = "supplygrp";
    $DB_PASSWORD = "sg3dev2";
    $DB_NAME = "supplygrp";

    //EMAIL SETTINGS
    $SEND_EMAILS = TRUE;
    $EMAIL_PROTOCOL = "SMTP";           //mail OR sendmail OR smtp
    //set smtp details
    $EMAIL_SMTP_HOST = "localhost";
    $EMAIL_SMTP_PORT = "25";
    $EMAIL_SMTP_AUTH_REQUIRED = FALSE;
    $EMAIL_SMTP_SECURE = "";            // '' OR ssl OR tls
    $EMAIL_SMTP_USERNAME = "";
    $EMAIL_SMTP_PASSWORD = "";

    //FILE UPLOAD SETTINGS
    $UPLOAD_DIRECTORY_PATH = "uploads/";
    $UPLOAD_DIRECTORY_FULL_PATH = "/usr/local/sites/supplygrp/uploads/";
    $UPLOAD_LOGO_PATH = "logos/";
    $MAX_UPLOAD_SIZE = 10;              //In MB
    $MAX_UPLOAD_SIZE_PER_REQUEST = 10;  //In MB
}
elseif($svrEnv == "DEVL")
{
    //BASE URL
    $BASE_URL = "http://".$_SERVER['SERVER_NAME']."/supplygrp/www/";

    //DATABASE SETTINGS
    $DB_HOST = "localhost";
    $DB_USER = "supplygrp";
    $DB_PASSWORD = "mypassword";
    $DB_NAME = "supplygrp";

    //EMAIL SETTINGS
    $SEND_EMAILS = FALSE;
    $EMAIL_PROTOCOL = "SMTP";           //mail OR sendmail OR smtp
    //set smtp details
    $EMAIL_SMTP_HOST = "";
    $EMAIL_SMTP_PORT = "";
    $EMAIL_SMTP_AUTH_REQUIRED = FALSE;
    $EMAIL_SMTP_SECURE = "";            // '' OR ssl OR tls
    $EMAIL_SMTP_USERNAME = "";
    $EMAIL_SMTP_PASSWORD = "";

    //FILE UPLOAD SETTINGS
    $UPLOAD_DIRECTORY_PATH = "uploads/";
    $UPLOAD_DIRECTORY_FULL_PATH = "C:/easyphpwebserver/www/supplygroup/uploads/";
    $UPLOAD_LOGO_PATH = "logos/";
    $MAX_UPLOAD_SIZE = 4;               //In MB
    $MAX_UPLOAD_SIZE_PER_REQUEST = 8;   //In MB
}

?>
Was it helpful?

Solution

So it looks like what you are missing is editing your hosts file and creating a virtualhost container for apache.

Virtual Host file

NameVirtualHost *:80 # you only need this once in the entire config
<VirtualHost *:80>
    ServerName thedomain
    ServerAlias *.thedomain
    DocumentRoot "C:/easyphpwebserver/www/supplygroup"
    <Directory "C:/easyphpwebserver/www/supplygroup">
      AllowOverride All
    </Directory>
</VirtualHost>

The problem is in order to use the subdomains youll need to run your own local DNS unless you want to add every possible subdomain to the hosts file - this is because the hosts file doesnt support wildcard hostnames.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top