Error using libraries in PHP

Asked

Viewed 54 times

1

I’m trying to add the following:

require_once __DIR__.'/vendor/autoload.php';
require_once __DIR__.'/settings.php';
require_once __DIR__.'/resources.php';
require_once __DIR__.'/utils.php';

use Spire\Settings;
use Spire\Resources;
use Spire\Utils;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

use Silex\Application;

However the server returns me error where there is the use of the backslash (" "). What is the necessary configuration for the server to recognize in the correct way?

  • 4

    Configuration required: (PHP 5 >= 5.3.0)

  • I will now check the PHP version

  • 1

    actually, the version of php on the server is 5.2.17. It wouldn’t have worked. Thank you

2 answers

2

The error is due to the use of Namespaces in your code.

Note the use of the word use in your code. In this part of your application it is used to import the specific Namespace that will be used in your code.

As mentioned by Papa Charlie in comments, PHP supports Namespaces from version 5.3 only.

More informations about Namespace:

http://php.net/manual/en/language.namespaces.php

1


Namespaces are supported as of php 5.3, you’re probably using an earlier version.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.