cPanel 上的 Zendframework 2
Zendframework 2 on cPanel
我正在尝试在子域的 cpanel 上安装 zf2。 www.domain.ro/test。
我在目录 public_html/test 中提取了 zip 文件。
所以我在 test/zf 文件夹结构中:
bin
library
resources
composer.json
...
在 public_html/test 我有 php.ini 和 include_path:
include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/cPanelUsername/public_html/test/zf/library"
为了测试 zf2 是否安装正确,我创建了一个 zend-test.php 行:
<?
phpinfo();
require_once 'Zend/Mail.php';
$mail=new Zend_Mail();
echo 'it is working';
?>
我有错误:
Warning: require_once(Zend/Mail.php): failed to open stream: No such file or directory in /home/cPanelUsername/public_html/test/zend-test.php on line 3
Fatal error: require_once(): Failed opening required 'Zend/Mail.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/cPanelUsername/public_html/test/zf/library') in /home/cPanelUsername/public_html/test/zend-test.php on line 3
我使用 ZF2_PATH 环境变量成功了。
在目录 public_html/test 中,我创建了一个包含以下行的 index.php 文件:
putenv( "ZF2_PATH=/home/cPanelUsername/public_html/test/zf/library");
include "zf/application/public/index.php";
然后我在 zf 文件夹中创建应用程序文件夹。
应用程序文件夹结构:
config
data
module
public
这样问题就解决了。我可以在带有 www.domain.com/test 等子域的 cPanel 上使用 zf2 来测试 propose.
我正在尝试在子域的 cpanel 上安装 zf2。 www.domain.ro/test。 我在目录 public_html/test 中提取了 zip 文件。 所以我在 test/zf 文件夹结构中:
bin
library
resources
composer.json
...
在 public_html/test 我有 php.ini 和 include_path:
include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/cPanelUsername/public_html/test/zf/library"
为了测试 zf2 是否安装正确,我创建了一个 zend-test.php 行:
<?
phpinfo();
require_once 'Zend/Mail.php';
$mail=new Zend_Mail();
echo 'it is working';
?>
我有错误:
Warning: require_once(Zend/Mail.php): failed to open stream: No such file or directory in /home/cPanelUsername/public_html/test/zend-test.php on line 3
Fatal error: require_once(): Failed opening required 'Zend/Mail.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/cPanelUsername/public_html/test/zf/library') in /home/cPanelUsername/public_html/test/zend-test.php on line 3
我使用 ZF2_PATH 环境变量成功了。 在目录 public_html/test 中,我创建了一个包含以下行的 index.php 文件:
putenv( "ZF2_PATH=/home/cPanelUsername/public_html/test/zf/library");
include "zf/application/public/index.php";
然后我在 zf 文件夹中创建应用程序文件夹。 应用程序文件夹结构:
config
data
module
public
这样问题就解决了。我可以在带有 www.domain.com/test 等子域的 cPanel 上使用 zf2 来测试 propose.