Zend框架快速入门索引文件无法正常工作

问题描述 投票:0回答:1

嗨伙计们我是Zend框架的新手,今天只有我开始学习它。所以我的第一步是我在我的系统中安装ZF1所以我已经完成了从下面链接https://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html安装所需的步骤

当我运行http://localhost/quickstart/

它显示的是它没有运行index.php文件的那些文件的索引

任何人可以帮助我我做了什么错误,我正在使用ubuntu服务器

下面是我所遵循的事情,我已经下载了它下载了两个zip文件,一个是zendAuth,另一个是和zend框架1.12.20,我创建了一个文件夹名称quickstart,我已经将这些文件移动到quickstart里面。

所以现在我的文件在/var/www/quickstart/zendAuth/Zemdframeowrk 1.12.20

我在php.ini做了/etc/php/7.2/apache2/php.ini变化,并且我做了include_path = ".:/var/www/quickstart/zendAuth/library"

然后在文件末尾的apache2.conf文件中添加了以下代码

 <VirtualHost *:80>
    DocumentRoot "/var/www"
    ServerName localhost
</VirtualHost>
    <VirtualHost *:80>
        ServerName quickstart.local
        DocumentRoot /var/www/html/quickstart/zendAuth/public

        SetEnv APPLICATION_ENV "development"

        <Directory /var/www/html/quickstart/zendAuth/public>
            DirectoryIndex index.php
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>

And in hosts file at the top  of the file i have added this  `127.0.0.1    quickstart.local`

Can any one check and let me where i have done mistake and please help me out.

提前致谢。

php zend-framework
1个回答
4
投票

您可以尝试以下配置,然后为root和public文件夹设置.htaccess:

1)在hosts文件中输入如下

127.0.0.1       quickstart.local

2)在httpd-vhosts.conf中设置虚拟主机,如下所示

<VirtualHost *:80>
    ServerName quickstart.local
    DocumentRoot "/var/www/html/quickstart/zendAuth/public"
    ServerAlias quickstart.local
    <Directory "/var/www/html/quickstart/zendAuth/public">
        AllowOverride All
        Require all granted
     </Directory>
</VirtualHost>

3)检查root htaccess如下

SetEnv APPLICATION_ENV development
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php [L]
IndexIgnore *
Options -Indexes

4)检查公共文件夹中的htaccess,如下所示

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/$ /$1 [R=302,NE,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}/index.php [L]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
© www.soinside.com 2019 - 2024. All rights reserved.