Hades85
Hades85

Reputation: 121

PHP/Composer include and path-handling

i have got a local installation of xampp with wordpress. xampp -> htdocs -> mywordpress -> composerproject content of composerproject

I am using a wordpressplugin to include php in articles of wordpress like this

include('../composerproject/recanalyst/test.php');

Everything works fine on a local maschine with xampp an the same wordpress both are working with php 7.1.

But when i deploy the same on my webspace with following settings: paths of webspace

define('ROOTPATH', __DIR__);
echo ROOTPATH;
require ROOTPATH . '/vendor/autoload.php';

use RecAnalyst\RecordedGame;

$filename = ROOTPATH . '/test.mgz';


$rec = new RecordedGame($filename);// This line 12 doesnt work

Error line 12

Uncaught Error: Class 'RecAnalyst\RecordedGame' not found in /var/www/vhosts/myhoster.net/httpdocs/recanalyst/test.php:12 Stack trace: #0 

Composerproject on github: enter link description here

Upvotes: 0

Views: 51

Answers (1)

Hades85
Hades85

Reputation: 121

Can be closed. My webhoster is running with php 7.1 but their cli was running with 5.3.3. So i had installed with putty an old version of composer without recognizing it. Changing the CLI to 7.1 was the solution.

Upvotes: 1

Related Questions