1

朋友们,我尝试将我的 yii 生产应用程序从 cloud9 IDE 部署到 OpenShift,同时这样做,我收到了这个错误消息,

 CException

应用程序运行时路径“/var/lib/openshift/51dd48794382ecfd530001e8/app-root/runtime/repo/php/protected/runtime”无效。请确保它是 Web 服务器进程可写的目录。

即使我chmod -R 775 directory在 Cloud9 IDE 上将文件夹权限更改为 775 ( ) 并再次部署,但我得到了同样的错误。

4

3 回答 3

1

这是一个老问题,但我最近遇到了同样的问题。

当您提取“yii”包时,有几个文件夹是空的,“framework/protected/runtime”就是其中之一。

要部署到 OpenShift,您需要将 yii 包提交到 git,然后将提交推送到 OS。但是,git 不会提交空文件夹,因此它们不会在您的部署中创建。在提交/推送之前,您需要在这些文件夹中创建一些文件并将这些文件添加到您的 git 存储库中。通常的程序是将“.gitkeep”文件添加到这些文件夹中(它只是一个空的虚拟文件,因此 git 会看到这些文件夹)。

这将解决这个特定的错误。

于 2013-10-12T15:12:14.603 回答
0

For Yii applications, the assets and protected/runtime folders are special. First, both folders must exist and writable by the server (httpd) process. Second, these two folders contains temporary files, and should be ignored by git. If these temporary files got committed, deployment in plain servers (not Openshift servers) would cause git merge conflicts. So I put these two folders in .gitignore :

php/assets/
php/protected/runtime/

In my deployment, I add a shell script to be called by openshift, creating both folders under $OPENSHIFT_DATA_DIR and creating symbolic link to both of them in the application's folders. This is the content of the shell script (.openshift/action_hooks/deploy) which I adapted from here :

#!/bin/bash
if [ ! -d $OPENSHIFT_DATA_DIR/runtime ]; then
mkdir $OPENSHIFT_DATA_DIR/runtime
fi
# remove symlink if already exists, fix problem when with gears > 1 and nodes > 1
rm $OPENSHIFT_REPO_DIR/php/protected/runtime
ln -sf $OPENSHIFT_DATA_DIR/runtime $OPENSHIFT_REPO_DIR/php/protected/runtime

if [ ! -d $OPENSHIFT_DATA_DIR/assets ]; then
mkdir $OPENSHIFT_DATA_DIR/assets
fi

rm $OPENSHIFT_REPO_DIR/php/assets
ln -sf $OPENSHIFT_DATA_DIR/assets $OPENSHIFT_REPO_DIR/php/assets

The shell script ensures the temporary folders created on each gear after openshift deployment. By default, a new directory's right are u+rwx, and it became writable by the httpd process because the gear runs httpd as the gear user (not apache or something else).

于 2014-07-06T14:21:08.667 回答
0

这可能是由于授予文件夹的所有权。检查网络服务器用户组,该目录是否可写,以及当我们更改平台时对网络服务器有何影响。

希望我的建议有用。

于 2013-07-27T08:54:56.193 回答