【问题标题】:Magento store not working on localhostMagento 商店无法在 localhost 上运行
【发布时间】:2013-10-25 08:52:17
【问题描述】:

我正在尝试在我的本地主机 wamp 服务器的实时服务器上运行一个 magento 商店。我正在使用带有 wamp 的 windows 7 x64,其中包括:Apache 2.2.22、PHP 5.3.13 和 MySQL 5.5.24。 这是我在尝试运行商店时遇到的以下错误:

    Whoops, it looks like you have an invalid PHP version.
    Magento supports PHP 5.2.0 or newer. Find out how to install Magento using PHP-CGI as a work-around.

        '; exit; } 
    /** * Error reporting */ 
    error_reporting( /*E_ALL | E_STRICT */ 0); 
    /** * Compilation includes configuration file */ 
    define('MAGENTO_ROOT', getcwd()); $compilerConfig = MAGENTO_ROOT . '/includes/config.php'; 
if (file_exists($compilerConfig)) { include $compilerConfig; } $mageFilename = MAGENTO_ROOT . '/app/Mage.php'; $maintenanceFile = 'maintenance.flag'; if (!file_exists($mageFilename)) { if (is_dir('downloader')) { header("Location: downloader"); } else { echo $mageFilename." was not found"; } exit; } if (file_exists($maintenanceFile)) { include_once dirname(__FILE__) . '/errors/503.php'; exit; } require_once $mageFilename; #Varien_Profiler::enable(); if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { Mage::setIsDeveloperMode(true); } #ini_set('display_errors', 1); umask(0); 
    /* Store or website code */ 
    $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; 
    /* Run store or run website */ $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; Mage::run($mageRunCode, $mageRunType); 

在过去的一周里,我尝试做了以下事情:

  1. 为 php 版本安装了 php_curl 修复程序。 php_curl 扩展有效,因为当我安装新的 magento 副本时,它可以正常工作。
  2. 我检查了安装 Magento 的所有系统要求的列表,并且 php 扩展都在工作。
  3. 我将 php.ini 中的 memory_limit 从 128M 更改为 512M。
  4. 我将 app/etc 中的 local.xml 文件修改为指向我的 localhost 和 db_name、db_user、db_pass,这是我为这个商店创建的 localy。
  5. 我从本地数据库中的实时服务器导入了数据库,并修改了 core_config 表中的 base_url 选项
  6. 我打开了 apache 模块 headers_module、rewrite_module、include_module 和 php5_module。
  7. 我尝试将 .htaccess 编辑为 rewrite_base,但没有任何改变。
  8. 我尝试从 .htaccess AddType x-mapp-php5 .php 和 AddHandler x-mapp-php5 .php 从 .htaccess 中注释掉,但之后没有任何显示,所以我保留原样,未注释。
  9. 我使用了 4-5 个版本的 php 和 apache.. 但没有任何效果。

现在最后一件事.. 在我的 apache 错误日志中.. 我得到的最后一件事是以下行:

[Fri Oct 25 11:50:14 2013] [warn] Cannot get media type from 'x-mapp-php5'

请帮我解决这个问题。 提前感谢您的时间和帮助。

【问题讨论】:

  • 你添加了虚拟主机来运行magento吗?如果是,请也复制一下
  • 你看到的是Magento的index.php的内容。很可能您的服务器上没有安装 PHP。
  • 我添加了虚拟主机但没有工作,所以我将其修改回普通主机。主机看起来像这样:127.0.0.1 localhost/mysite @SKV
  • 我在我的服务器上安装了 php,因为我正在使用 wamp 对其他东西进行编程,例如自定义 mvc、wordpress 和全新的 magento 安装。他们都工作正常@Marius
  • Dragos 这是来自主机文件的配置,你有没有在 xamp 的 vhost-httpd 文件中插入任何代码?

标签: php apache magento localhost


【解决方案1】:

尝试在 localhost 上运行 magento,如下所示:

检查您的设备 IP 并将以下行添加到 windows/system32/drivers/etchosts 文件中

192.168.1.59       magento.hue
192.168.1.59       www.magento.hue

请相应更改 IP。

然后转到 you-xamp-installation/apache/conf-extra/httpd-vhosts.conf

并添加以下内容

NameVirtualHost 192.168.1.59:80
<VirtualHost magento.hue>
    ServerAdmin magento.hue
    DocumentRoot "C:/www/mag_domain/"
    ServerName magento.hue
    ServerAlias www.magento.hue
    ErrorLog "C:/www/mag_domain/error.log"
    CustomLog "C:/www/mag_domain/access.log" combined
    <Directory "C:/www/mag_domain">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

假设 C:/www/mag_domain/ 是您下载实时站点的文件夹的路径。相应地改变。

将 db 导入本地 mysql 并更改 app/etc/local.xml 中的用户名/密码等

然后尝试在浏览器上运行http://magento.hue 并告知结果。

请尝试使用一组新的 magento 站点和数据库,以防您更改了其中的某些内容。

【讨论】:

  • 感谢您的提示。我与一些朋友交谈,他们要求我将商店的相同副本放在不同的服务器上。我在开发服务器的子域上上传并配置了商店。一样的东西。一些朋友告诉我,这是核心或其中一个模块中的 php 问题,所以我一个一个地禁用了这些模块,并且全部禁用,但没有任何效果。我认为php代码有问题,但我不知道在哪里。至少我知道这不是配置文件或服务器问题。 @SKV
  • 您也可以重命名核心 Mage 文件夹并从相同版本的新下载文件中上传,可能可行。
  • 最后一次尝试,也重命名zend文件夹..并手动删除会话中的所有文件,缓存,锁等。检查是否有效。
  • 什么都没有。也这样做了。谢谢你的时间。感谢您的帮助@SKV
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-29
相关资源
最近更新 更多