将 Zend 框架站点迁移到新主机 - "An error occurred Page not found"



我是ZF的新手,在将当前活动的站点移动到新主机时遇到问题。新主机正在使用IP和用户名作为域的临时开发URL上运行。当我试图直接导航到运行该网站的index.php页面时,我得到了404。该网站还没有真正的域名,这是不是有问题?ZF是否设置为检查路径/域是最初设置的,但现在找不到该域?

当前的LIVE站点设置在名为/share/的子目录中。我可以通过FTP访问当前的LIVE站点,并且在根目录中似乎没有任何htaccess重定向来将您带到index.php文件所在的路径:/share/clients/public/index.php

我还迁移了数据库,找到了带有数据库用户名/密码的application.inimonster.ini文件,并将它们更新到新的数据库中。我假设这些仍然在localhost上运行。

当前开发URL正在IP/用户路径上运行。

示例:http://1.2.3.4/~username/

当我导航到:http://1.2.3.4/~username/share/clients/public/index.php时,我得到一个404错误。

如果我在根目录中设置重定向到相同的目录,我会得到相同的结果。

关于问题在哪里有什么想法吗?我被难住了提前感谢您的帮助,尤其是快速回复。这个网站需要尽快上线

/clients/目录中的HTACCESS:

AddType application/x-httpd-php53 .php
SetEnv APPLICATION_ENV production
RewriteEngine On
RewriteRule ^.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /clients/public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/clients/public/.*$
RewriteRule ^(.*)$ /clients/public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /clients/public/index.php [NC,L]

/public/目录中的INDEX.PHP:

//This line changes the timeout. //Give it a value in seconds (3600 = 1 hour) 
set_time_limit(3600);
//Set these amounts to whatever you need. 
ini_set("post_max_size","8192M");
ini_set("upload_max_filesize","8192M");
//Generally speaking, the memory_limit should be higher //than your post size. So make sure that’s right too. 
ini_set("memory_limit","8200M");
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Define path to uploads directory
defined('APPLICATION_UPLOADS_DIR') || define('APPLICATION_UPLOADS_DIR', realpath(dirname(__FILE__) . '/../files'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
//get_include_path(),
)));

更新:我修改了HTACCESS文件(一个在根目录中,一个在"client"目录中),现在导致了"找不到页面"错误。我觉得我有进步了,但显然还没有达到所有的目标。

An error occurred Page not found
Exception information:
Message: Invalid controller specified (~username)
Stack trace:
#0 /home3/username/public_html/share/clients/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /home3/username/public_html/share/clients/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 /home3/username/public_html/share/clients/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 /home3/username/public_html/share/clients/public/index.php(47): Zend_Application->run()
#4 {main}   
Request Parameters:
array (
'controller' => '~username',
'action' => 'index',
'module' => 'default',
)   
o;io;

更新2:经过进一步的修补和搜索,以下内容让我进入了一个登录页面(针对客户端?),但仍然没有主页。

感谢Artur Michalak在这里找到的答案指定的无效控制器()-Zend Framework

当我将以下内容添加到我的application.ini文件中时,它使网站解析为登录页面。

resources.frontController.baseUrl = "/[alias directory]"

UPDATE 3:我还将/clients目录中的.htaccess复制到根目录,并将路径更新为COMPLETE路径。

示例:如果路径最初是/clients/public/index.php,我将其更改为/~username/share/clients/public/index.php。在root/clients目录中都是如此。

已解决:

好的,我的情况涉及到将Zend Framework安装从一个主机移动到另一个主机。更复杂的是,网站的这一部分不是"前端",加上主域托管在一个地方,主网站托管在另一个位置,然后我的部分托管在第三个位置。

最后,我需要的是让所有子域请求指向我的Zend安装,一旦所有部件都就位,这就相当容易了。

  1. 在安装Zend的cPanel中设置子域
  2. 设置相同的子域和A-Record指向托管我的Zend安装
  3. htaccess规则保留在其最初的设置,因为他们带来了移动的Zend框架(即。反转我上面所做的所有编辑)

就是这样。。。唯一的区别是,我将DirectoryIndex设置为指向子文件夹中的索引文件,但除此之外,一切都像champ一样工作。

多么让人头疼。希望这能帮助其他人,为你节省很多时间。

祝你好运!

相关内容

最新更新