我的小论坛是一个简单的基于PHP和MySQL的互联网论坛, 以古典线索视图(树结构)显示消息。它 是GNU通用公共许可证下的开源代码。这个网络论坛的主要 索赔是简单的。此外,它应该很容易 安装和运行在一个标准的服务器配置与PHP和 MySQL。在Cloud Foundry上部署开源CMS'我的小论坛'(需要PHP和MySQL)
我试图在基于Cloud Foundry的托管上部署mylittleforum。
安装
解压脚本包。 将完整的文件夹“论坛”上传到你的服务器。
根据您的服务器配置 子目录templates_c的写权限(CHMOD 770,775或777)和文件 配置/ db_settings.php(CHMOD 666)可能需要为了 改变,他们是可写的由剧本。通过 运行安装脚本,在您的网络浏览器中访问yourdomain.tld/forum/install /并按照 的说明操作。
我所做的:
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更新发现该安装程序位于http://mylittleforum.domain/install/
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推输出
$ 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
PHP Buildpac ■选项(.bp-config/options.json
)
$ pwd
/Users/RomeoOw/Downloads/mylittleforum-2.3.5
$ cat .bp-config/options.json
{
"WEBDIR": ""
}
我ssh到容器(后删除应用程序,并再次推,这是奇怪的时间戳,我猜是因为S3文件缓存):
$ cf ssh mylittleforum
[email protected]:~$ pwd
/home/vcap
[email protected]:~$ 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
[email protected]:~$ cd app/
[email protected]:~/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
[email protected]:~/app$ cd install/
[email protected]:~/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
我想:
$ 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 APP输出似乎健康mylittleforum started 1/1 1G 1G mylittleforum.domain
我看了一下app/.bp/logs/bp.log
与cf ssh
。没有用处。启用BP调试后,日志目录丢失。
cf set-env mylittleforum BP_DEBUG true
没过repush,也发现了我在Safari请求导致500我的要求之前,有很多的调试日志,没有任何有用的信息。见cf logs --recent
输出here
当我访问其他URL /index.php/install/
,还有额外的HTTP标头(Set-Cookie
,Pragma
,Expires
和Cache-Control
)
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
'curl'命令很可能会尝试执行PHP代码(这很好),因为它返回500(另一个原因可能是Web服务器配置错误)。 'cf logs --recent'有没有提示? –
是的,日志中没有太多有用的信息。使用当前信息很难确定故障,但是您可以尝试[排除PHP构建包故障](http://docs.cloudfoundry.org/buildpacks/php/gsg-php-usage.html#troubleshooting)。如果您发现有趣的事,请告诉我。 –
不幸的是我在新的日志中找不到任何其他提示。但是,我注意到mylittleforum没有提供'.htaccess'配置mod_rewrite,因此请尝试检查buildpack如何设置它。另外,尝试访问http://mylittleforum.domain/index.php/install/以查看是否可以工作(如果mod_rewrite未正确配置,可能会出现这种情况)。 –