Moving Zend Framework site to new host - “An error occurred Page not found”

ⅰ亾dé卋堺 提交于 2019-12-11 23:34:16

问题


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.


回答1:


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.

  1. Setup a subdomain in my cPanel where Zend is installed.
  2. Setup the same subdomain and A-Record to point to the IP address of the hosting for my Zend install.
  3. 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!



来源:https://stackoverflow.com/questions/22176181/moving-zend-framework-site-to-new-host-an-error-occurred-page-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!