将Zend Framework站点移至新主机-“未发生错误的页面未找到" [英] Moving Zend Framework site to new host - "An error occurred Page not found"
问题描述
我是ZF的新手,并且在将当前活动站点移至新主机时遇到问题.新主机正在使用IP和用户名作为域的临时dev URL上运行.当我尝试直接导航到运行该站点的index.php页面时(我认为),我得到404.该站点还没有真正的域存在问题吗? ZF设置是否要检查路径/域是否是最初设置的,而现在找不到该域?
当前LIVE站点是在名为/share/
的子目录中设置的.我可以通过FTP访问当前的LIVE站点,并且在根目录中似乎没有任何htaccess重定向,以便您可以找到index.php
文件所在的路径:/share/clients/public/index.php
.>
我还迁移了数据库,并找到了具有数据库用户名/密码的application.ini
和monster.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文件(一个位于根目录中,一个位于客户端"目录中),现在导致出现找不到页面"错误.我觉得自己要到某个地方了,但显然还没有击中所有气瓶.
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]"
更新3:
我还将在/clients
目录中找到的.htaccess
复制到了根目录,并将路径更新为COMPLETE路径.
示例:
如果该路径最初是/clients/public/index.php
,则将其更改为/~username/share/clients/public/index.php
.在root
和/clients
目录中都是如此.
已解决:
好的,我的情况涉及将Zend Framework安装从一台主机转移到另一台主机.使事情变得复杂的是,网站的这一部分不是前端",加上主域名托管在一个地方,主网站托管在另一个地方,然后我的一部分托管在第三个位置.
最后,我需要的是让所有 subdomain 请求都指向我的Zend安装,事实证明,一旦所有部分都完成,这将变得相当容易.就位.
- 在我的安装了Zend的cPanel中设置一个子域.
- 设置 相同的子域和A记录,以指向 托管我的Zend安装.
- 将
htaccess
规则留在他们的 与移动的Zend框架一同出现时的原始设置(即 撤消我在上面所做的所有修改)
就是这样! ...唯一的不同是,我将DirectoryIndex
设置为指向驻留在子文件夹中的索引文件,但是否则其他所有内容都像冠军一样.
真是头疼.希望这可以帮助其他人,并为您节省很多时间.
祝你好运!
I'm new to ZF and having issues moving a currently live site to a new host. The new host is running on a temporary dev URL using the IP and username as the domain. When I attempt to navigate directly to the index.php page that (I think) runs the site, I get a 404. Is there an issue with the site not having an true domain yet? Is ZF setup to check the path/domain is was originally setup on and now it's not finding that domain?
The currently LIVE site is setup in a subdirectory called /share/
. I'm able to access the current LIVE site via FTP, and there doesn't appear to be any htaccess redirect in the root to get you to the path where the index.php
file appears to be located: /share/clients/public/index.php
.
I've also migrated the database and found the application.ini
and monster.ini
files with the DB username/password, and I've updated them to the new DB. I'm assuming these still run on localhost
.
Current Development URL is running on an IP/user path.
EXAMPLE: http://1.2.3.4/~username/
When I navigate to: http://1.2.3.4/~username/share/clients/public/index.php
, I get a 404 Error.
If I setup a redirect in the root to that same directory, I get the same result.
Any ideas on where the issue is? I'm getting stumped. THANKS in advance for any help and especially quick replies. This site needs to up SOON!
HTACCESS IN THE /clients/
directory:
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]
INDEX.PHP in the /public/
directory:
//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(),
)));
UPDATE: I've tinkered with the HTACCESS files (one in the root, one in the "clients" directory), and have now resulted in a "Page not found" error. I feel like I'm getting somewhere, but obviously not hitting on all cylinders yet.
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;
UPDATE 2: After further tinkering and searching, the following has gotten me to a login page (for clients?), but still no home page.
Thanks to Artur Michalak in an answer found here Invalid controller specified() - Zend Framework
When I added the following to my application.ini
file, it got the site to resolve to a login page.
resources.frontController.baseUrl = "/[alias directory]"
UPDATE 3:
I also copied the .htaccess
found in the /clients
directory to the root, and updated the paths to the COMPLETE path.
EXAMPLE:
If the path originally was /clients/public/index.php
, I changed it to /~username/share/clients/public/index.php
. This is true both in the root
and /clients
directories.
SOLVED:
OK, my situation involved moving a Zend Framework installation from one host to another. To complicate matters, this part of the website isn't the "front end", plus the primary domain is hosted in one place, the main website is hosted at another, and then there's my part hosted at a 3rd location.
In the end, what I was needing was getting all subdomain requests to point to my Zend install, and it turned out to be rather easy once all the parts were in place.
- Setup a subdomain in my cPanel where Zend is installed.
- Setup the same subdomain and A-Record to point to the IP address of the hosting for my Zend install.
- Leave the
htaccess
rules in their original setup as they came over with the moved Zend framework (i.e. reverse all of the edits I made up above)
That's it! ... The only difference is that I set the DirectoryIndex
to point to the index file that resides in the subfolder, but otherwise everything works like a champ.
What a flippin headache. Hopefully this helps somebody else and saves you a lot of time.
Good luck!
这篇关于将Zend Framework站点移至新主机-“未发生错误的页面未找到"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!