首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Cloud上部署开源CMS“我的小论坛”(需要PHP和MySQL)

在Cloud上部署开源CMS“我的小论坛”(需要PHP和MySQL)
EN

Stack Overflow用户
提问于 2016-07-29 19:08:32
回答 1查看 169关注 0票数 1

我的小论坛是一个简单的基于PHP和MySQL的互联网论坛,它在经典的线程视图(树结构)中显示消息。它是在GNU通用公共许可证下获得许可的开放源码。这个网络论坛的主要主张是简单。此外,使用PHP和MySQL在标准服务器配置上安装和运行应该很容易。

我试图在基于云创建的主机上部署mylittleforum

安装 解压缩脚本包。上传完整的文件夹“论坛”到您的服务器。 根据您的服务器配置,可能需要更改子目录templates_c (CHMOD 770、775或777)和文件config/db_setings.php (CHMOD 666)的写权限,以便脚本可以写入它们。在您的web浏览器中访问您的domain.tld/forum/install/运行安装脚本,并按照说明执行。

我所做的:

代码语言:javascript
复制
wget -nd https://github.com/ilosuna/mylittleforum/archive/v2.3.5.tar.gz
tar xvfz v2.3.5.tar.gz
cd mylittleforum-2.3.5/
cf cs mariadb large mylittleforum-db
cf push mylittleforum -b https://github.com/cloudfoundry/php-buildpack.git
cf bs mylittleforum mylittleforum-db
cf env mylittleforum
vi config/db_settings.php 
<?php
// Database host, mostly 'localhost':
$db_settings['host'] = '10.0.20.18';

// Database name:
$db_settings['database'] = 'CF_39CC64E1_578D_IIF3_BF1F_BC06LDIDK74009';

// Database user name:
$db_settings['user'] = '84mwzL9fonrlptzmGn';

// Database password:
$db_settings['password'] = 'xzG1s0dff89lYtunp5Mn';

// Database tables (normally not necessary to edit): 
$db_settings['settings_table'] =       'mlf2_settings';
$db_settings['forum_table'] =          'mlf2_entries';
$db_settings['category_table'] =       'mlf2_categories';
$db_settings['userdata_table'] =       'mlf2_userdata';
$db_settings['smilies_table'] =        'mlf2_smilies';
$db_settings['pages_table'] =          'mlf2_pages';
$db_settings['banlists_table'] =       'mlf2_banlists';
$db_settings['useronline_table'] =     'mlf2_useronline';
$db_settings['login_control_table'] =  'mlf2_logincontrol';
$db_settings['entry_cache_table'] =    'mlf2_entries_cache';
$db_settings['userdata_cache_table'] = 'mlf2_userdata_cache';
?>
chmod 777 config/db_settings.php
cf push mylittleforum -b https://github.com/cloudfoundry/php-buildpack.git

然后尝试启动安装程序,但收到404。Update发现安装程序位于http://mylittleforum.domain/install/

代码语言:javascript
复制
curl -I http://mylittleforum.domain/forum/install/
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=iso-8859-1
Date: Fri, 29 Jul 2016 19:03:25 GMT
Server: Apache
X-Vcap-Request-Id: bd734b38-bb6e-4167-731c-f20d8aabfb51

CF推送输出

代码语言:javascript
复制
$ cf push mylittleforum -b https://github.com/cloudfoundry/php-buildpack.git
Updating app mylittleforum in org xxx / space xxx as xxx...
OK

Uploading mylittleforum...
Uploading app files from: /Users/xxx/Downloads/mylittleforum-2.3.5
Uploading 2M, 405 files
Done uploading               
OK

Stopping app mylittleforum in org xxx / space xxx as xxx...
OK

Starting app mylittleforum in org xxx / space xxx as xxx...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (1008.5K)
Downloading build artifacts cache...
Downloaded build artifacts cache (109B)
Staging...
-------> Buildpack version 4.3.17
Installing HTTPD
Downloaded [https://buildpacks.cloudfoundry.org/concourse-binaries/httpd/httpd-2.4.23-linux-x64.tgz] to [/tmp]
Installing PHP
PHP 5.5.37
Downloaded [https://buildpacks.cloudfoundry.org/concourse-binaries/php/php-5.5.37-linux-x64-1468353118.tgz] to [/tmp]
Finished: [2016-07-29 19:16:32.177909]
Exit status 0
Staging complete
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (109B)
Uploaded droplet (48.3M)
Uploading complete

1 of 1 instances running

App started


OK

App mylittleforum was started using this command `$HOME/.bp/bin/start`

Showing health and status for app mylittleforum in org xxx / space xxx as xxx...
OK

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: mylittleforum.domain
last uploaded: Fri Jul 29 19:16:18 UTC 2016
stack: cflinuxfs2
buildpack: https://github.com/cloudfoundry/php-buildpack.git

     state     since                    cpu    memory        disk           details
#0   running   2016-07-29 09:16:51 PM   0.5%   22.7M of 1G   142.6M of 1G

(.bp-config/options.json)

代码语言:javascript
复制
$ pwd
/Users/RomeoOw/Downloads/mylittleforum-2.3.5
$ cat .bp-config/options.json 
{
    "WEBDIR": ""
}

我将ssh放入容器(在删除应用程序并再次推送之后,这是奇怪的时间戳,我猜是因为S3文件缓存):

代码语言:javascript
复制
$ cf ssh mylittleforum
vcap@88b21d94-0a7d-4c7c-74f9-2c1af0b49578:~$ pwd
/home/vcap
vcap@88b21d94-0a7d-4c7c-74f9-2c1af0b49578:~$ ls -al
total 36
drwx------  6 vcap vcap 4096 Jul 31 14:19 .
drwxr-xr-x  4 root root 4096 Jul 31 14:20 ..
drwxr-xr-x 19 vcap root 4096 Jul 31 14:19 app
-rw-r--r--  1 vcap vcap  220 Apr  9  2014 .bash_logout
-rw-r--r--  1 vcap vcap 3637 Apr  9  2014 .bashrc
drwxr-xr-x  2 vcap vcap 4096 Jul 31 14:19 logs
-rw-r--r--  1 vcap vcap  675 Apr  9  2014 .profile
-rw-r--r--  1 vcap vcap   64 Jul 31 14:19 staging_info.yml
drwxr-xr-x  2 vcap vcap 4096 Jul 31 14:22 tmp
vcap@88b21d94-0a7d-4c7c-74f9-2c1af0b49578:~$ cd app/
vcap@88b21d94-0a7d-4c7c-74f9-2c1af0b49578:~/app$ ls -lrt
total 124
-rw-r--r-- 1 vcap vcap  1158 Jul 31 14:19 README.md
-rw-r--r-- 1 vcap vcap 33093 Jul 31 14:19 LICENSE
-rw-r--r-- 1 vcap vcap  7757 Jul 31 14:19 index.php
-rw-r--r-- 1 vcap vcap 17047 Jul 31 14:19 CHANGELOG
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 update
drwxr-xr-x 3 vcap vcap  4096 Jul 31 14:19 themes
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 templates_c
drwxr-xr-x 8 vcap vcap  4096 Jul 31 14:19 modules
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 lang
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 js
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 install
drwxr-xr-x 3 vcap vcap  4096 Jul 31 14:19 includes
drwxr-xr-x 5 vcap vcap  4096 Jul 31 14:19 images
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 config
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:19 backup
drwxr-xr-x 7 vcap vcap  4096 Jul 31 14:19 httpd
drwxr-xr-x 8 vcap vcap  4096 Jul 31 14:19 php
drwxr-xr-x 2 vcap vcap  4096 Jul 31 14:20 logs
vcap@88b21d94-0a7d-4c7c-74f9-2c1af0b49578:~/app$ cd install/
vcap@88b21d94-0a7d-4c7c-74f9-2c1af0b49578:~/app/install$ ls -lrt
total 40
-rw-r--r-- 1 vcap vcap 12765 Jul 31 14:19 install.sql
-rw-r--r-- 1 vcap vcap 21779 Jul 31 14:19 index.php

我试过:

代码语言:javascript
复制
$ curl -I http://mylittleforum.domain/install/
HTTP/1.1 500 Internal Server Error
Content-Type: text/html
Date: Sun, 31 Jul 2016 14:27:06 GMT
Server: Apache
X-Vcap-Request-Id: ab6db4f1-78ff-483e-7b74-09211fd0b6b9

这是我的应用程序日志(我尝试了错误的和好的路径)。错误路径/forum/install/给404,好路径/install/给500。在日志中,我没有看到比状态代码为500的信息更多的信息。CF应用程序输出似乎是健康的mylittleforum started 1/1 1G 1G mylittleforum.domain

我看了一下app/.bp/logs/bp.logcf ssh。没什么有用的。启用BP调试后,日志dir丢失。

代码语言:javascript
复制
cf set-env mylittleforum BP_DEBUG true

做了一个更新,并发现也没有任何有用的信息,我的要求在Safari,结果是500。在我的请求之前,有很多调试日志。参见cf logs --recent输出这里

当我访问其他/index.php/install/时,会有额外的headers (Set-CookiePragmaExpiresCache-Control)。

代码语言:javascript
复制
curl -I http://mylittleforum.domain/index.php/install/
HTTP/1.1 500 Internal Server Error
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-Type: text/html
Date: Sun, 31 Jul 2016 20:14:56 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Server: Apache
Set-Cookie: __VCAP_ID__=1334380f-6a6c-400c-62aa-56b07b4044b6; Path=/; HttpOnly
Set-Cookie: JSESSIONID=fvqr2fe7ac5gd73k24lr8drom7; path=/; HttpOnly
X-Vcap-Request-Id: f4aa004c-87a8-482e-60cd-c5704c6cf9da
EN

回答 1

Stack Overflow用户

发布于 2016-07-31 09:46:28

在buildpack选项中设置WEBDIR:

看起来,buildpack试图为buildpack配置的WEBDIR变量中定义的文件夹提供服务,默认为htdocs。mylittleforum期望从项目的根目录中提供文件,因此尝试将更改buildpack选项值设置为空字符串。

从环境中获取配置:

除此之外,我建议您通过使用config/db_settings.php ( phpenv() (见手册)函数获取相应的环境变量来设置见手册

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38665954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档