如何从本地计算机运行此CI php应用程序

时间:2012-03-01 16:33:14

标签: php codeigniter wamp server-configuration

我需要帮助我认为简单的本地机器设置。

我们的暂存和生产服务器上都有一个php codeIgniter应用程序。我一直在编辑,测试,确认然后移动生产。看起来我们将在短期内做出一些重大改变,所以我决定将登台代码移到我的本地机器上,这样我就可以真正地破解它了。由于这是令人尴尬的,我无法将这个php应用程序配置为在我的本地计算机上运行以挽救我的生命。经过一个多星期的尝试,我被尴尬地糊涂,陷入沮丧,陷入绝望之中。这不像我之前没有在我的本地机器上安装过应用程序,但是这个应用程序正在杀了我。

有关此应用的一些见解。这是一个供应申请应用程序,多个客户可以访问,并且课程由客户帐号控制。

客户端“啊”在[ahh.supplygrp.com]中输入他们的浏览器,url将他们带到他们的登录页面,他们登录并访问所有“他们的”公司相关信息。客户“Bee”在[bee.supplygrp.com]中输入他们的浏览器,url将他们带到他们的登录页面,他们登录并访问所有'他们'的公司相关信息等等。

Ahh和Bee是acct_name,[请参阅db schema附件]所以url转到服务器,找到应用程序,在数据库中查找Ahh或Bee,如果找到,附加服​​务器名称,打开该URL将是ahh.supplygrp.com,显示登录页面,成功登录>>你离开了。

我知道我正在绊倒服务器名,虚拟主机,主机文件,配置文件规则。我错过了什么,我不知道是什么。我在我的电脑上设置了一个新安装的easyphp5 ++ [WAMP],验证它适用于基本的php页面和Codeigniter的通用安装。我还安装了有问题的应用程序及其db。

任何人都可以通过我需要做的事情,因为它与服务器,主机文件,配置文件,虚拟主机配置相关,以使我的本地计算机上运行此应用程序。

附加配置文件,acct架构以供参考。

提前非常感谢。

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
}

?>

1 个答案:

答案 0 :(得分:1)

所以看起来你缺少的是编辑你的hosts文件并为apache创建一个virtualhost容器。

虚拟主机文件

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>

问题是为了使用您需要运行自己的本地DNS的子域,除非您想将所有可能的子域添加到hosts文件 - 这是因为hosts文件不支持通配符主机名。