I'm running into a 500 Internal Server Error
when trying to install craft (on openshift).
Environment:
- Platform: OpenShift (nginx-php7 cartridge: https://github.com/pinodex/openshift-cartridge-nginx-php7)
- Craft CMS v2.6.2931
- Nginx: 1.11.3
- PHP: 7.0.9 (FPM)
- MySQL: 5.5.50
The installation starts ok but crashes shortly after:
URL: http://my-domain.com/admin/install
POST http://my-domain.com/index.php/admin/actions/install/install 500 (Internal Server Error)
send @ jquery-2.2.1.min.js?d=1473694215:4
ajax @ jquery-2.2.1.min.js?d=1473694215:4
postActionRequest @ craft.js:388
(anonymous function) @ install.js:84
f @ jquery-2.2.1.min.js?d=1473694215:2
(anonymous function) @ install.js:152
f @ jquery-2.2.1.min.js?d=1473694215:2
l @ velocity.min.js?d=1473694215:3
k @ velocity.min.js?d=1473694215:3
nginx default configuration:
server {
root /var/lib/openshift/xxxxxxx/app-root/runtime/repo//public_html;
listen 127.0.0.1:8080;
server_name mydomain.com;
index index.php index.html index.htm ;
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
# avoid caching by proxies
add_header Cache-Control private;
error_page 404 /index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/lib/openshift/xxxxxxx/nginx-php7//run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include openshift_params;
# uncomment to export all environment variables to fastcgi
#include /var/lib/openshift/xxxxxxx/app-root/runtime/repo//config/nginx.d/export_env;
}
location ~ ^(.*)$ {
try_files $uri $uri/ /index.php?p=$uri&$args;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ttf|ttc|otf|eot|woff)$ {
try_files $uri /index.php?$query_string;
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* \.(?:css|js)$ {
try_files $uri /index.php?$query_string;
expires 1y;
add_header Cache-Control "public";
}
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~* (?:\.(?:bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$ {
deny all;
access_log off;
log_not_found off;
}
}
craft.log:
2016/09/12 15:30:56 [warning] [application] Skipping record /var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/records/BaseRecord.php because it’s abstract or an interface.
The only PHP error I'm seeing (repeated about 6 times during the install):
[12-Sep-2016 16:44:29 UTC] PHP Warning: strpos(): Empty needle in /var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/bootstrap.php on line 126
I've checked the permissions on all required write-enabled folders are ok, but still can't figure out what's preventing the install.
Can anyone help me identify whats causing this issue?
EDIT:
my craft/config/general.php
file:
<?php
// Get environment
require('_env.php');
/**
* General Configuration
*
* All of your system's general configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/general.php
*/
return array(
// Universal settings
'*' => array(
'usePathInfo' => true,
'omitScriptNameInUrls' => true,
// 'enableCsrfProtection' => true,
'environmentVariables' => array(
'baseUrl' => $customEnv['baseUrl'],
'basePath' => $customEnv['basePath'],
)
),
);
my craft/config/_env.php
file:
<?php
$customEnv = array(
// Path info
'baseUrl' => 'http://my-domain.com',
'basePath' => '/var/lib/openshift/xxxxxxx/app-root/runtime/repo//public_html',
// Database connection info
'server' => getenv('OPENSHIFT_MYSQL_DB_HOST'),
'user' => getenv('OPENSHIFT_MYSQL_DB_USERNAME'),
'password' => getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),
'database' => getenv('OPENSHIFT_APP_NAME'),
// General config settings
'general' => array(
// Config settings for this environment
),
);
my craft/config/db.php
file:
<?php
// Get environment
// require('_env.php');
/**
* Database Configuration
*
* All of your system's database configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/db.php
*/
return array(
// The database server name or IP address. Usually this is 'localhost' or '127.0.0.1'.
'server' => getenv('OPENSHIFT_MYSQL_DB_HOST'),
// The database username to connect with.
'user' => getenv('OPENSHIFT_MYSQL_DB_USERNAME'),
// The database password to connect with.
'password' => getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),
// The name of the database to select.
'database' => getenv('OPENSHIFT_APP_NAME'),
// The prefix to use when naming tables. This can be no more than 5 characters.
'tablePrefix' => 'craft',
);