这是在 Cakephp 2.x 中的操作方式
一旦您设置了您的网站空间,您就不需要更改或破坏 php 配置(只要 php 被设置为该网站空间的默认设置)并且 当您在 Plesk 中创建 web_space 时,Plesk 服务器通常会这样做一切都适合你。
但是当您需要在 Plesk 服务器中配置 CakePhp 应用程序时,您需要遵循这些:
当您创建新的 DNS 或 web_space Plesk 为您创建目录结构时,您需要将您的应用程序放在创建的目录中并在这些文件夹中配置 htaccess,如下所示(只需在路径中添加一些“/”):
CakePHP root directory (must be copied to your document; redirects everything to your CakePHP app and updated to):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L] #to=> /app/webroot/
RewriteRule (.*) app/webroot/$1 [L] #to=> /app/webroot/$1
</IfModule>
CakePHP app directory (will be copied to the top directory of your application by bake):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L] #to=> /webroot/
RewriteRule (.*) webroot/$1 [L] #to=> /webroot/$1
</IfModule>
CakePHP webroot directory (will be copied to your application’s web root by bake):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L] #to=> /index.php
</IfModule>
当然,您需要配置您的数据库。
为此,您需要在您的 plesk 服务器中为您的应用程序设置一个新数据库,然后获取:
- 数据库ip地址
- 数据库名称
- 数据库用户名
- 数据库密码
并使用新的数据库详细信息更新您的 app/Config/database.php。如您所知:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'ip address here',
'login' => 'database username',
'password' => 'database password',
'database' => 'database name'
);
Here is how to configure Cakephp 3.x
希望对你有帮助