Zend 框架快速启动索引文件不起作用
Zend framework quickstart index file is not working
大家好,我是 Zend 框架的新手,今天才开始学习 it.so 我的第一步是在我的系统中安装 ZF1,所以我已经完成了从下面安装所需的步骤 link https://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html
而当我 运行 http://localhost/quickstart/
它显示那些文件的索引它不是 运行ning index.php 文件
任何人都可以帮助我我犯了什么错误并且我正在使用 ubuntu 服务器
以下是我遵循的内容 我下载了两个 zip 文件,一个是 zendAuth,另一个是 zend framework 1.12.20
我已经创建了一个名为 quickstart 的文件夹,并且我已将这些文件移动到 quickstart 中。
所以现在我的文件在 /var/www/quickstart/zendAuth/Zemdframeowrk 1.12.20
下
并且我在 /etc/php/7.2/apache2/php.ini
中进行了 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.
提前致谢。
您可以尝试以下配置,然后为根目录和 public 文件夹设置 .htaccess:
1) 主机文件中的条目如下
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) 检查 public 文件夹中的 htacess,如下所示
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/$ / [R=302,NE,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteCond %{REQUEST_URI}:: ^(/.+)/(.*)::$
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]
大家好,我是 Zend 框架的新手,今天才开始学习 it.so 我的第一步是在我的系统中安装 ZF1,所以我已经完成了从下面安装所需的步骤 link https://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html
而当我 运行 http://localhost/quickstart/
它显示那些文件的索引它不是 运行ning index.php 文件
任何人都可以帮助我我犯了什么错误并且我正在使用 ubuntu 服务器
以下是我遵循的内容 我下载了两个 zip 文件,一个是 zendAuth,另一个是 zend framework 1.12.20 我已经创建了一个名为 quickstart 的文件夹,并且我已将这些文件移动到 quickstart 中。
所以现在我的文件在 /var/www/quickstart/zendAuth/Zemdframeowrk 1.12.20
并且我在 /etc/php/7.2/apache2/php.ini
中进行了 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.
提前致谢。
您可以尝试以下配置,然后为根目录和 public 文件夹设置 .htaccess:
1) 主机文件中的条目如下
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) 检查 public 文件夹中的 htacess,如下所示
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/$ / [R=302,NE,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteCond %{REQUEST_URI}:: ^(/.+)/(.*)::$
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]