Project Routing

Ok, let’s get start by downloading (see the Download button for subscribers) or cloning the CodeBattles project. Now, follow the file to get things working. It involves downloading Composer and installing the vendor libraries:

$ git clone
$ cd rest
$ curl -sS | php
$ php composer.phar install


If you’re new to Composer, watch The Wonderful World of Composer.

When that’s done, start up the app by using PHP’s awesome built-in web server:

$ cd web
$ php -S localhost:8000


The built-in web server requires PHP 5.4, which all of you should have! If you’re using PHP 5.3, you’ll need to configure a VirtualHost of your web server to point at the web/ directory.

If it worked, then load up the site by going to http://localhost:8000. Awesome!

About the App

CodeBattles is built in Silex, a PHP microframework. If this is your first time using Silex, take a few minutes with its Documentation to get to know it. It basically let’s us design routes, or pages and easily write the code to render those pages. Our setup will look just a little bit different than this, but the idea is the same.

But this is not a tutorial on building a REST API on only Silex! Most of what we’ll do is basically the same across any framework. You will need to do a little bit of work here and there. But trust me, these things are a pleasure to do compared with all the tough REST stuff.

First Endpoint: POST /api/programmers

Let’s pretend we’re building the API for an iPhone app. Ignoring authentication, what’s the first thing the user will do in the app? Create a programmer of course! And that’s our first API endpoint.

Separate URLs from our Web Interface?

But hold up! In the web version of our app, we’re already able to create a programmer by filling out a form and submitting it via POST to /programmers/new. This either re-renders the HTML page with errors or redirects us.

Why not just reuse the code from this URL and make it work for our API? To do this we’d need to make it accept JSON request data, become smart enough to return errors as JSON and do something other than a redirect on success. Then, /programmers could be used by a browser to get HTML or by an API client to pass JSON back and forth.

That would be sweet! And later, we’ll talk about how you could do that. But for now, things will be a lot easier to understand if we leave the web interface alone, prefix our API URLs with /api, and write separate code for it.

This does break a rule of REST, because each resource will now have 2 URLs: one for HTML and one for the JSON representation. But REST has a lot of rules, too many for our rebel Codebattles site. We’ll break this one, like many APIs. But later, I’ll show you how we could use 1 URL to return multiple representation.

Basic Routing

So let’s build the endpoint. Find the src/KnpU/CodeBattle/Controller/Api/ProgrammerController.php file and uncomment the route definition:

// src/KnpU/CodeBattle/Controller/Api/ProgrammerController.php
// ...

protected function addRoutes(ControllerCollection $controllers)
    $controllers->post('/api/programmers', array($this, 'newAction'));

Next, create a newAction inside of this class and return let's battle!:

// src/KnpU/CodeBattle/Controller/Api/ProgrammerController.php
// ...

public function newAction()
    return 'let\'s battle!';

And just like that, we’re making threats and we have a new endpoint with the URL /api/programmers. If we make a POST request here, the newAction function will be executed and these famous last words will be returned in the response. This is the core of what Silex gives us.

URLs and Resources

My choice of a POST request to create a programmer isn’t accidental. /api/programmers is a collection resource. And according to some HTTP rules I’ll show you later, when you want to create a resource, you should send a POST request to its collection.

In other words, I’m not making this all up: I’m following the rules of the web. And in the API world, if you follow the rules, you’ll have more friends.

Testing the Endpoint

Well let’s try it already! That’s actually not easy in a browser, since we need to make a POST request. Instead, open up the testing.php file at the root of the project that I’ve already prep’ed for us:

// testing.php
require __DIR__.'/vendor/autoload.php';

use Guzzle\Http\Client;

// create our http client (Guzzle)
$client = new Client('http://localhost:8000', array(
    'request.options' => array(
        'exceptions' => false,

This is a plain PHP file that creates a Guzzle Client object. Guzzle is a simple library for making HTTP requests and receiving responses.

Let’s make a POST request to /api/programmers and print out the response:

// testing.php
// ...
$client = new Client('http://localhost:8000', array(
    'request.options' => array(
        'exceptions' => false,

$request = $client->post('/api/programmers');
$response = $request->send();

echo $response;
echo "\n\n";

Try it out by running the file from the command line. You’ll need to open a new terminal tab and make sure you’re at the root of the project where the file is:

$ php testing.php
HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
Cache-Control: no-cache
Content-Type: text/html; charset=UTF-8

let's battle!


Leave a comment!

  • 2017-10-05 Diego Aguiar

    Oh, so you have a permissions problem, try this:

    $ chmod www-data:www-data var/*

    (you may need to run it with "sudo")


  • 2017-10-04 RAJAONA Ywoumé

    i have this error when i use my apache in ls -s /home/myfolder/www/rest /var/www/html when i use in localhost:8000 it was working . this is the full error

    Fatal error: Uncaught UnexpectedValueException: The stream or file "/home/ywoume/www/rest/src/KnpU/CodeBattle/../../../logs/development.log" could not be opened: failed to open stream: Permission denied in /home/ywoume/www/rest/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 70
    ( ! ) UnexpectedValueException: The stream or file "/home/ywoume/www/rest/src/KnpU/CodeBattle/../../../logs/development.log" could not be opened: failed to open stream: Permission denied in /home/ywoume/www/rest/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 70

  • 2017-10-04 Diego Aguiar

    Hey RAJAONA Ywoumé

    Could you show me the full error message? I'm not sure what's going on, maybe the data folder is not being found or you don't have the right permissions

    I need more info about the error so I can help you debugging :)


  • 2017-10-04 RAJAONA Ywoumé

    Hi, i've this problem

    Fatal error: Uncaught Symfony\Component\Filesystem\Exception\IOException: Failed to chmod file "/home/ywoume/www/rest/src/KnpU/CodeBattle/../../../data". i've doing chmod -R 777 logs/ and create a data directory in parent and doing 777 in data/ directory but i've this error

  • 2017-09-25 Victor Bocharsky

    Hey maxii123 ,

    Looks like the problem not in Composer but in your PHP environment. Could you tell us a bit more what are you trying to do? Do you want to use SQLite as your DB? What OS are you on? Is it Ubuntu?

    Also, I see you have a new SQLite 3 installed. Probably, you have an older version of "doctrine/dbal" that does not support it yet. I'd recommend to upgrade "doctrine/dbal" to the latest available version, or, downgrade your SQLite to 2.x.

    And keep in mind, that if you run your website with PHP-FPM - it has its own php.ini config which lives in "/etc/php/7.0/fpm/" folder, so you need to look into that folder and see the configuration from web request. Thanks to Symfony, it has a link to see phpinfo() in Web Debug Toolbar.


  • 2017-09-24 maxii123

    Is composer missing something?

    Fatal error: Uncaught PDOException: could not find driver in /home/rgr/development/gitprojects/rest/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 85
    ( ! ) Doctrine\DBAL\Exception\DriverException: An exception occured in driver: could not find driver in /home/rgr/development/gitprojects/rest/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php on line 85
    Call Stack
    # Time Memory Function Location
    1 0.0001 358600 {main}( ) .../index.php:0
    2 0.0001 358920 require_once( '/home/rgr/development/gitprojects/rest/app/bootstrap.php' ) .../index.php:6
    3 0.0028 582008 KnpU\CodeBattle\DataFixtures\FixturesManager->resetDatabase( ) .../bootstrap.php:31
    4 0.0047 814616 Doctrine\DBAL\Schema\AbstractSchemaManager->dropAndCreateTable( ) .../FixturesManager.php:48
    5 0.0057 840360 Doctrine\DBAL\Schema\AbstractSchemaManager->createTable( ) .../AbstractSchemaManager.php:583
    6 0.0068 963808 Doctrine\DBAL\Schema\AbstractSchemaManager->_execSql( ) .../AbstractSchemaManager.php:443
    7 0.0068 963808 Doctrine\DBAL\Connection->executeUpdate( ) .../AbstractSchemaManager.php:1017
    8 0.0068 963808 Doctrine\DBAL\Connection->connect( ) .../Connection.php:973
    9 0.0068 963808 Doctrine\DBAL\Driver\PDOSqlite\Driver->connect( ) .../Connection.php:360

    rgr ([web] master$ php -i | grep sqlite
    PDO drivers => mysql, sqlite
    sqlite3.extension_dir => no value => no value

  • 2017-08-11 Victor Bocharsky

    Hey Nina,

    1. Hmm, I suppose you are on Windows? I used Git Bash instead of native Windows cmd console and IIRC it has chmod command - I'd recommend to try to use it. This Git Bash console should be installed after installing Git for Windows. Or, I believe you can change file permissions via GUI (right mouse click on folder and search for Permissions tab). But, first of all, try to skip this step at all, I _think_ it shouldn't have permission problems on Windows, just try it.

    2. Well, bin/console is a Symfony Console, which comes with Symfony SE. But in this course we don't use Symfony SE - we use Silex (see composer.json file). So, we just use low-level native PHP command to tun built-in web server ;)

    3. On Linux/Mac OS you can see the detailed documentation about cURL command with available options: "$ man curl". But probably this command doesn't work on Windows. But, I believe "$ curl --help" should work, so try to use it. From this help I see:
    -S, --show-error Show error. With -s, make curl show errors when they occur
    -s, --silent Silent mode (don't output anything)


  • 2017-08-11 Nina


    I have a few questions:
    1.when I write:
    > chmod 777 logs data
    'chmod' is not recognized as an internal or external command,
    operable program or batch file.

    How can I check that directories are writeable?

    2.Why in this course we start web-server with command:
    php -S localhost:8000
    and in other course we use php bin/console server:run?

    3.What mean in the
    curl -sS | php
    option '-sS'

  • 2017-08-07 Victor Bocharsky

    Hey Nico,

    You need to configure timezone in php.ini. To find where your php.ini is, run:
    $ php --ini

    Then find "Loaded Configuration File" path and open in a text editor. Search for "date.timezone" and set it with the proper value from here like:
    date.timezone = "Europe/Amsterdam"


  • 2017-08-02 Nico Sedivy

    I cannot launch the app in the web browser. When I go to http://localhost:8000 I see a screen with this text:

    Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/neex/Documents/Coding/eclipse-workspace/rest-master/vendor/monolog/monolog/src/Monolog/Logger.php on line 214
    Whoops, looks like something went wrong.

    RuntimeException in NativeSessionStorage.php line 144:
    Failed to start the session because headers have already been sent by "/Users/neex/Documents/Coding/eclipse-workspace/rest-master/vendor/monolog/monolog/src/Monolog/Logger.php" at line 214.
    1. in NativeSessionStorage.php line 144
    2. at NativeSessionStorage->start() in NativeSessionStorage.php line 268
    3. at NativeSessionStorage->getBag('attributes') in Session.php line 97
    4. at Session->set('_security.main.target_path', 'http://localhost:8000/') in ExceptionListener.php line 213
    5. at ExceptionListener->setTargetPath(object(Request)) in ExceptionListener.php line 191
    6. at ExceptionListener->startAuthentication(object(Request), object(InsufficientAuthenticationException)) in ExceptionListener.php line 131
    7. at ExceptionListener->handleAccessDeniedException(object(GetResponseForExceptionEvent), object(AccessDeniedException)) in ExceptionListener.php line 97
    8. at ExceptionListener->onKernelException(object(GetResponseForExceptionEvent), 'kernel.exception', object(EventDispatcher))
    9. at call_user_func(array(object(ExceptionListener), 'onKernelException'), object(GetResponseForExceptionEvent), 'kernel.exception', object(EventDispatcher)) in EventDispatcher.php line 164
    10. at EventDispatcher->doDispatch(array(array(object(ExceptionListener), 'onKernelException'), array(object(LogListener), 'onKernelException'), array(object(ExceptionHandler), 'onSilexError')), 'kernel.exception', object(GetResponseForExceptionEvent)) in EventDispatcher.php line 53
    11. at EventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in HttpKernel.php line 224
    at HttpKernel->handleException(object(AccessDeniedException), object(Request), '1') in HttpKernel.php line 76
    12. at HttpKernel->handle(object(Request), '1', true) in Application.php line 581
    13. at Application->handle(object(Request)) in Application.php line 558
    14. at Application->run(object(Request)) in index.php line 27

    Has anyone else had something similar happen?

  • 2017-05-17 Diego Aguiar

    No problem man :) I'm glad I could help you.


  • 2017-05-17 Marin

    My bad Diego Aguiar, I was looking at "KnpU\CodeBattle\Controller\ProgrammerController", while the tutorial works on "KnpU\CodeBattle\Controller\Api\ProgrammerController", which indeed starts as a blank file when cloning the repo.

  • 2017-05-16 Diego Aguiar

    Hey Marin

    Master branch should contain the starting files for this tutorial (From chapter 1), if for some reason you are getting the finished files (which is weird) you can download the project from this page, in the right upper corner we have a "Download" button. I hope it helps you :)

    Have a nice day!

  • 2017-05-16 Marin

    After cloning the Git repo, which branch do we switch to? The "master" branch already contains the finished code, and none of the other existing remote branches seems to start from the point where this video starts from.

  • 2017-04-25 Ben

    Thanks Victor! i got it to work

  • 2017-04-20 Victor Bocharsky

    Hey Ben,

    Some packages you're trying to install require CURL extension for PHP. You have to install it first. If you're on Ubuntu, you can install it with APT:
    $ sudo apt-get update
    $ sudo apt-get install php70-curl

    Or try to find how to install CURL PHP extension for your OS. It will solve the problem.


  • 2017-04-17 Ben

    Hi, I am getting this error message.
    I have already installed composer on it running
    'curl -sS | php'

    I have also used 'php composer install' and 'composer update'
    I've tried googling to find the answer and looking at the forums but no luck!

    Thanks in advance.


    Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
    Your requirements could not be resolved to an installable set of packages.

    Problem 1
    - Installation request for fabpot/goutte v1.0.7 -> satisfiable by fabpot/goutte[v1.0.7].
    - fabpot/goutte v1.0.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    Problem 2
    - Installation request for guzzle/guzzle v3.9.3 -> satisfiable by guzzle/guzzle[v3.9.3].
    - guzzle/guzzle v3.9.3 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    Problem 3
    - Installation request for instaclick/php-webdriver 1.0.17 -> satisfiable by instaclick/php-webdriver[1.0.17].
    - instaclick/php-webdriver 1.0.17 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    Problem 4
    - fabpot/goutte v1.0.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.
    - behat/mink-goutte-driver v1.0.9 requires fabpot/goutte ~1.0.1 -> satisfiable by fabpot/goutte[v1.0.7].
    - Installation request for behat/mink-goutte-driver v1.0.9 -> satisfiable by behat/mink-goutte-driver[v1.0.9].

    To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/15-xml.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-dom.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gd.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mbstring.ini
    - /etc/php/7.0/cli/conf.d/20-mcrypt.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-simplexml.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.0/cli/conf.d/20-wddx.ini
    - /etc/php/7.0/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.0/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.0/cli/conf.d/20-xsl.ini
    You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

  • 2016-10-13 weaverryan

    Hey @curious!

    Both of the REST courses (this one and part 2) are built on the same project and same repository ( Does that help? If you download the course code for episode 2, we actually give you the correct starting code for that course (which is the same finish code as this course - course 1).

    I'm not sure if I answered your question correctly - but if not - let me know and we'll be happy to help.


  • 2016-10-13 curious

    Do course1 has different repo ?

  • 2016-08-18 weaverryan

    Ah, thanks for the clarification - I looked too quickly and didn't notice which tutorial you were asking about! I'm glad you got it working - despite my not-so-perfect help :).

    And yep, we're here if you have any comments or questions - both help everyone.


  • 2016-08-18 3amprogrammer

    Thanks for the replay. I have no idea what the heck was wrong, but when I removed the files and pasted it again everything magically worked - probably it was some issue with permissions, I have no idea.

    And by the way, I think you misunderstood me. Homestead works well with Symfony all it needs is to add type: Symfony to Homestead.yaml.
    I had a problem of running regular app from REST course using index.php as a root, not app.php or app_dev.php.

    Nevertheless, everything is working fine now. I really appreciate I can count on you when any questions pop out :)

  • 2016-08-15 weaverryan

    Hey 3amprogrammer!

    Yea, Homestead is awesome! We have some docs about specifically using it with Symfony, in case you haven't seen it already :)

    But specifically, the issue is that Symfony doesn't have an "index.php" file - it has "app.php" and "app_dev.php". The best way to solve this is either to:

    A) Look back at your homestead setup - it has configuration for symfony, which should take care of this for you
    B) Look at the Nginx documentation for Symfony - - and tweak your setup to match this.

    In both cases, what you basically need to change is to tell Nginx to execute either app.php or app_dev.php, instead of index.php.

    Let me know if this helps! Cheers!

  • 2016-08-13 3amprogrammer

    I am using laravel/homestead box and when I try to access my browser downloads the file, but when I type everything works just fine. I have tried to do some googling, but yet without any success.

    This is my conf file. Can you please give me some hint as I dont know nginx much.

    server {
    listen 80;
    listen 443 ssl http2;
    root "/home/vagrant/Code/code-battles/web";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
    try_files $uri $uri/ /index.php?$query_string;

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    access_log off;
    error_log /var/log/nginx/ error;

    sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    fastcgi_intercept_errors off;
    fastcgi_buffer_size 16k;
    fastcgi_buffers 4 16k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;

    location ~ /\.ht {
    deny all;

    ssl_certificate /etc/nginx/ssl/;
    ssl_certificate_key /etc/nginx/ssl/;
  • 2016-08-04 weaverryan

    Glad you got it figured out Ken! I'm not sure what went wrong - I just downloaded the code and it worked ok (I double-checked that it *did* install the Symfony Finder library that seemed to be missing for you). Perhaps there was a momentary download issue the first time you ran composer install.

    Cheers and good luck!

  • 2016-08-04 Victor Bocharsky

    Hey Ken,

    Most likely, you have missed composer dependencies, so just try to run "composer install" first and it should help. And sure, you can configure a virtual host for your Apache real web server, check the official Apache configuration example. Ensure you use configuration example for your version of Apache.


  • 2016-08-03 Ken

    The problem seemed to be in the compsor.json file. I removed the require-dev statement and it seems to work on my Lamp stack

  • 2016-08-03 Ken

    I can't get started. I run the webservere in the terminal window,

    When I the localhost:8000 I get the following error
    [Wed Aug 3 11:43:42 2016] PHP Fatal error: Class 'Symfony\Component\Filesystem\Filesystem' not found in /home/ken/NetBeansProjects/rest/src/KnpU/CodeBattle/DataFixtures/FixturesManager.php on line 29
    [Wed Aug 3 11:43:42 2016] PHP Stack trace:
    [Wed Aug 3 11:43:42 2016] PHP 1. {main}() /home/ken/NetBeansProjects/rest/web/index.php:0
    [Wed Aug 3 11:43:42 2016] PHP 2. require_once() /home/ken/NetBeansProjects/rest/web/index.php:6
    [Wed Aug 3 11:43:42 2016] PHP 3. KnpU\CodeBattle\DataFixtures\FixturesManager->resetDatabase() /home/ken/NetBeansProjects/rest/app/bootstrap.php:31
    [Wed Aug 3 11:43:42 2016] [200]: / - Class 'Symfony\Component\Filesystem\Filesystem' not found in /home/ken/NetBeansProjects/rest/src/KnpU/CodeBattle/DataFixtures/FixturesManager.php on line 29

    Is there a way to either run the code on my nomal apache feed or do you have a fix for this


  • 2016-05-31 weaverryan

    Wow, that *is* weird! But, I like your debugging techniques :). At this point, we haven't added any security, so it seems like the 403 is probably not coming from our Silex app (but, I could be missing something). Does the 403 (if you print out the response content in the test file) "look" like it's coming from your web server? Are you using the built-in web server? What happens if you try to curl the URL directly - e.g. curl http://localhost:8000/...

    I'm sure we can figure this out :)

  • 2016-05-26 ciudadano82

    Hi guys! i'm having a problem with the testing file. It throws me a 403 error. However, when i run it from the browser, it throws me the right response (i've changed the post() call to a get() call to prove it there, and also changed the guzzle request to a get call). Any help?

  • 2016-05-22 weaverryan

    Hi Florin!

    Ah, I know this problem :). This is a classic problem when you first install php - you need to set the date.timezone setting in php.ini. First, you need to find your php.ini file. If you're using the built-in php web server, you can find it by running this from the command line:

    php --ini

    Look for "Loaded Configuration File". That's your php.ini path. Open that file in an editor (you'll probably need sudo), and find the date.timezone line. Make sure it is not commented out (remove the ; at the beginning of the line) and set it to your timezone (from this list Mine looks like this:

    date.timezone = America/Detroit

    Then, kill your build-in web server (ctrl+c) and run it again. All should be well :)


  • 2016-05-21 Florin

    I have installed php 5.4.45 and is working now, but i still have one warning:

    Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/user/rest/vendor/monolog/monolog/src/Monolog/Logger.php on line 214

  • 2016-05-21 Florin

    Hello, i am getting this error: RuntimeException in NativeSessionStorage.php line 144:
    Failed to start the session because headers have already been sent by "/Users/user/rest/vendor/monolog/monolog/src/Monolog/Logger.php" at line 214.
    PHP version is 5.527. Thank you!

  • 2016-03-14 weaverryan

    Hey there!

    Hmm, it just looks like your local web server isn't running. When you get this error, are you able to go to `http://localhost:8000/api/programmers` in your browser? I expect that you will also see a connection refused error when you do this. If so, check that you started your built-in web server correctly - the commands are near the top of the script on this page :).


  • 2016-03-12 agape801

    Hello I am getting this error Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 7: Failed to connect to localhost port 8000: Connection refused [url] http://localhost:8000/api/programmers' in C:\Users\Agape\rest\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlMulti.php:359 ... I've tried as well and it didnt work

  • 2015-07-14 weaverryan


    The project uses SQLITE, so this sounds to me like pdo-sqlite driver isn't installed/enabled in your PHP install. If you run "php -i | grep sqlite", you should see some output related to pdo_sqlite (or if you're on windows, you can just run "php -i" and look in the output for pdo_sqlite stuff). Anyways, I think you *won't* find anything there. In that case, check how you installed PHP to see how to get this enabled.


  • 2015-07-14 Emberous

    Hello, i am getting this error: Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in /usr/share/nginx/html/test/rest/rest/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:40 Stack trace: #0