Zend MVC - get rid of a shared folder

Everything, My PHP Zend MVC application structure is as follows:

billingsystem
 -application
 -design
 -public
    --index.php
    --.htaccess
 -library
    -- Zend

whenever the application loads, it goes to index.php in the shared folder and it gets redirected from there. I want users to access the system by going to http: // billingsystem / instead of going to http: // billingsystem / public . This is a Zend convention for storing a shared folder. or can I get rid of it and move the files to the root directory? I tried to do this, but my application failed because it could not find the Zend library and load its classes. Some of my index.php code:

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

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

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

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

/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Loader.php';

//Autoload Zend Classes
Zend_Loader::loadClass('Zend_Loader_Autoloader');
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);

thank

+3
source share
4 answers

ZF , . , , , "" . Apache, DocumentRoot httpd.conf(1.x) apache2.conf(2.x). DocumentRoot, VirtualHosts, DocumentRoots. : http://apptools.com/phptools/virtualhost.php. Zend: http://framework.zend.com/wiki/display/ZFDEV/Configuring%2BYour%2BURL%2BRewriter

+3

, .

http://akrabat.com/zend-framework/zend-framework-on-a-shared-host/

, , .

index.php /

<?php 
define('RUNNING_FROM_ROOT', true);
include 'public/index.php';

.htaccess /

SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteRule .* index.php

, . , . , .

+1

EDIT:

:

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

.

/ .htaccess .

, . , .


, public - , . http://billingsystem.com path/to/project/public . . , , :

index.php

APPLICATION_PATH realpath(dirname(__FILE__).'/application');

, .htaccess library, application tests, -.

0
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

index.php .htaccess , .

0

Source: https://habr.com/ru/post/1731235/


All Articles