简体   繁体   English

在共享服务器上设置Yii

[英]Setting up Yii on Shared Server

I wish to use a PHP Framework such as Yii, however, it seems to set this up I need access to a terminal or console. 我希望使用像Yii这样的PHP框架,但是,它似乎设置了这个我需要访问终端或控制台。 Unfortunately my only access to the server is via an FTP client as it's shared hosting. 不幸的是,我唯一访问服务器是通过FTP客户端,因为它是共享主机。

Does this rule Yii out as a framework? 这会将Yii作为一个框架吗?

all you need to do is 你需要做的就是

1 - have a copy of yii framework folder 1 - 拥有yii框架文件夹的副本

2 - generate a new yiic webapp folder 2 - 生成一个新的yiic webapp文件夹

3 - upload both folders, the framework folder can go to some hidden place yoursite.com/wawa/framework/yii, and you can just upload the files in your webapp folder to yoursite.com/ 3 - 上传两个文件夹,框架文件夹可以转到某个隐藏的地方yoursite.com/wawa/framework/yii,你只需将webapp文件夹中的文件上传到yoursite.com/

4 - edit the index.php in your generated web app, so it know where your framework/yii folder is. 4 - 编辑生成的Web应用程序中的index.php,以便知道framework / yii文件夹的位置。 than you are set 比你设定的

5 - just make different copy of your webapp folder, so you don't need to generate them if you dont want to. 5 - 只需制作webapp文件夹的不同副本,因此如果您不想,则无需生成它们。 just use different names, wont make a difference, as long as the webapp index.php knows where your framework folder is, than it will work 只要使用不同的名称,就不会有所作为,只要webapp index.php知道你的框架文件夹在哪里,它就会起作用

根据这篇文章,您可以在计算机上生成所有文件,然后将文件上传到您的共享主机。

You only need a terminal for developing on your local server (it isn't a good idea to develop directly on a shared server). 您只需要一个终端在本地服务器上进行开发(直接在共享服务器上开发不是一个好主意)。 To use it on a shared server just upload it. 要在共享服务器上使用它,只需上传它。

In the strict sense you don't need a terminal. 从严格意义上讲,您不需要终端。 You could write your files yourself. 你可以自己编写你的文件。 The yiic program only creates a couple of php files. yiic程序只创建几个php文件。

I am first in Yii. 我是第一个在Yii。 Installed the application locally. 在本地安装应用程序。 FTP-ing the application to the share server in directory /home/sloki/user/h11741/sites/example.com/www then create abcd directory within /www and put framework into it. 将应用程序FTP到目录/home/sloki/user/h11741/sites/example.com/www中的共享服务器,然后在/ www中创建abcd目录并将框架放入其中。

Edit your index.php line 4 to be: $yii=dirname( FILE ).'/abcd/framework/yii.php'; 编辑index.php第4行为:$ yii = dirname( FILE )。'/ abcd / framework / yii.php';

You will get error message like this 你会收到这样的错误信息

Application runtime path "/home/sloki/user/h11741/sites/example.com/www/protected/runtime" is not valid. 应用程序运行时路径“/home/sloki/user/h11741/sites/example.com/www/protected/runtime”无效。 Please make sure it is a directory writable by the Web server process. 请确保它是Web服务器进程可写的目录。

Change permission of directories /protected/runtime and /assets to 777. Test the web, when success change again permission both directories to 775. 将目录/ protected / runtime和/ assets的权限更改为777.测试Web,当成功再次更改时,将两个目录的权限更改为775。

Gut lak. 肠道。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM