<p>Turns out that this was an issue with the OpenShift cartridge not Craft (<a href="https://github.com/pinodex/openshift-cartridge-nginx-php7/issues/8" rel="nofollow">https://github.com/pinodex/openshift-cartridge-nginx-php7/issues/8</a>).</p>

<p>The PHP <code>session.save_path</code> value was set to a different (non-existent)  directory than that which is created/defined when the cartridge is deployed.</p>

<p>The <code>craft.log</code> error (dev mode):</p>

<pre><code>2016/09/12 20:10:55 [error] [php] session_regenerate_id(): open(/var/lib/openshift/xxxxxxx/app-root/data//php-session/sess_vdm5q1ulu7285qmi6g86jnph87, O_RDWR) failed: No such file or directory (2) (/var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/framework/web/CHttpSession.php:185)
</code></pre>

<p>Not sure why I didn't get any errors in the PHP error logs.</p>

<p>Creating the <code>php-session</code> directory fixes the issue, but the cartridge needs to be updated.</p>

<p><strong>TL:DR</strong> PHP session settings issue caused by the OpenShift cartridge not Craft.</p>

CC BY-SA 3.0
2016-09-12T21:17:15.403Z
2016-09-12T21:17:15.403Z
Colin
<p>I think this is the causing the installer to trip up:</p>

<pre><code>[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
</code></pre>

<p>My guess is that there is something wrong with your environmental logic in <code>craft/config/general.php</code> (or maybe some off if you've modified Craft's public <code>index.php</code> as well).</p>

<p>I'd start by stripping that down to the basics and adding things back in one at a time until you find the culprit.</p>

CC BY-SA 3.0
2016-09-12T17:22:40.750Z
Thanks for the suggestion. I tried stripping the `general.php` file down to nothing, but am gettting the same error in the browser console. No PHP errors though (have PHP errors set to show everything). Also didn't make any edits to the public index.php file.
Colin
CC BY-SA 3.0
2016-09-12T17:28:24.867Z
Are you defining CRAFT_ENVIRONMENT anywhere? Can you share the contents of your `config/general.php` file with the sensitive bits stripped in the original question?
Brad Bell
CC BY-SA 3.0
2016-09-12T19:26:55.110Z
Added my `general.php`, `db.php` and `_env.php` files. Hope this helps.
Colin
CC BY-SA 3.0
2016-09-12T17:04:39.980Z
2016-09-12T17:04:39.980Z
Brad Bell
<p>I'm running into a <code>500 Internal Server Error</code> when trying to install craft (on openshift).</p>

<p><strong>Environment:</strong></p>

<ul>
<li>Platform: OpenShift (nginx-php7 cartridge: <a href="https://github.com/pinodex/openshift-cartridge-nginx-php7" rel="nofollow noreferrer">https://github.com/pinodex/openshift-cartridge-nginx-php7</a>)</li>
<li>Craft CMS v2.6.2931</li>
<li>Nginx: 1.11.3</li>
<li>PHP: 7.0.9 (FPM)</li>
<li>MySQL: 5.5.50</li>
</ul>

<p>The installation starts ok but crashes shortly after:</p>

<p>URL: <code>http://my-domain.com/admin/install</code></p>

<p><a href="https://i.sstatic.net/0XhAG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0XhAG.png" alt="enter image description here"></a>
Console output:</p>

<pre><code>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
</code></pre>

<p>nginx default configuration:</p>

<pre><code>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&amp;$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;
    }
}
</code></pre>

<p>craft.log:</p>

<pre><code>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.
</code></pre>

<p>The only PHP error I'm seeing (repeated about 6 times during the install):</p>

<pre><code>[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
</code></pre>

<p>I've checked the permissions on all required write-enabled folders are ok, but still can't figure out what's preventing the install.</p>

<p>Can anyone help me identify whats causing this issue?</p>

<p><strong>EDIT:</strong></p>

<p>my <code>craft/config/general.php</code> file:</p>

<pre><code>&lt;?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
    '*' =&gt; array(
        'usePathInfo' =&gt; true,
        'omitScriptNameInUrls' =&gt; true,
        // 'enableCsrfProtection' =&gt; true,
        'environmentVariables' =&gt; array(
            'baseUrl'  =&gt; $customEnv['baseUrl'],
            'basePath' =&gt; $customEnv['basePath'],
        )
    ),

);
</code></pre>

<p>my <code>craft/config/_env.php</code> file:</p>

<pre><code>&lt;?php

$customEnv = array(

    // Path info
    'baseUrl'  =&gt; 'http://my-domain.com',
    'basePath' =&gt; '/var/lib/openshift/xxxxxxx/app-root/runtime/repo//public_html',

    // Database connection info
    'server'   =&gt; getenv('OPENSHIFT_MYSQL_DB_HOST'),
    'user'     =&gt; getenv('OPENSHIFT_MYSQL_DB_USERNAME'),
    'password' =&gt; getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),
    'database' =&gt; getenv('OPENSHIFT_APP_NAME'),

    // General config settings
    'general' =&gt; array(
        // Config settings for this environment
    ),

);
</code></pre>

<p>my <code>craft/config/db.php</code> file:</p>

<pre><code>&lt;?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' =&gt; getenv('OPENSHIFT_MYSQL_DB_HOST'),

        // The database username to connect with.
        'user' =&gt; getenv('OPENSHIFT_MYSQL_DB_USERNAME'),

        // The database password to connect with.
        'password' =&gt; getenv('OPENSHIFT_MYSQL_DB_PASSWORD'),

        // The name of the database to select.
        'database' =&gt; getenv('OPENSHIFT_APP_NAME'),

        // The prefix to use when naming tables. This can be no more than 5 characters.
        'tablePrefix' =&gt; 'craft',

);
</code></pre>

<error-message><ajax><error><install><nginx>
500 Internal Server Error in OpenShift install
# 500 Internal Server Error in OpenShift install

(Asked by: username_0 on 2016-09-12)

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

Console output:
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:
 array(
        'usePathInfo' => true,
        'omitScriptNameInUrls' => true,
        // 'enableCsrfProtection' => true,
        'environmentVariables' => array(
            'baseUrl'  => $customEnv['baseUrl'],
            'basePath' => $customEnv['basePath'],
        )
    ),

);

my craft/config/_env.php file:
 '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:
 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',

);

**Tags:** error-message, ajax, error, install, nginx


---

## 2 answers

### Answer by username_0 on 2016-09-12. Score: 1 | Accepted answer

Turns out that this was an issue with the OpenShift cartridge not Craft (https://github.com/pinodex/openshift-cartridge-nginx-php7/issues/8).
The PHP session.save_path value was set to a different (non-existent)  directory than that which is created/defined when the cartridge is deployed.
The craft.log error (dev mode):
2016/09/12 20:10:55 [error] [php] session_regenerate_id(): open(/var/lib/openshift/xxxxxxx/app-root/data//php-session/sess_vdm5q1ulu7285qmi6g86jnph87, O_RDWR) failed: No such file or directory (2) (/var/lib/openshift/xxxxxxx/app-root/runtime/repo/craft/app/framework/web/CHttpSession.php:185)

Not sure why I didn't get any errors in the PHP error logs.
Creating the php-session directory fixes the issue, but the cartridge needs to be updated.
TL:DR PHP session settings issue caused by the OpenShift cartridge not Craft.


---

### Answer by username_1 on 2016-09-12. Score: 1

I think this is the causing the installer to trip up:
[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

My guess is that there is something wrong with your environmental logic in craft/config/general.php (or maybe some off if you've modified Craft's public index.php as well).
I'd start by stripping that down to the basics and adding things back in one at a time until you find the culprit.

> **Comments:**
> **username_0**: Thanks for the suggestion. I tried stripping the `general.php` file down to nothing, but am gettting the same error in the browser console. No PHP errors though (have PHP errors set to show everything). Also didn't make any edits to the public index.php file.  
> **username_1**: Are you defining CRAFT_ENVIRONMENT anywhere? Can you share the contents of your `config/general.php` file with the sensitive bits stripped in the original question?  
> **username_0**: Added my `general.php`, `db.php` and `_env.php` files. Hope this helps.  

---

