error in index.php
  • Hello,

    I have just uploaded all newscoop files to the server, and when I go to the index.php page I get the following error:
    Parse error: syntax error, unexpected ':' in /websites/123reg/LinuxPackage23/wi/g_/we/wig-web.co.uk/public_html/freenews/index.php on line 5

    Is there something wrong with the code on the index page, and if so, how can I fix it?

    Many Thanks

    Tog Porter
  • 9 Comments sorted by
  • The code for that page is: (the colon on line 5 is after the ?, but if I remove it I get another error.)

    line 1: <?php
    line 2: 
    line 3: $installPrefix = pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME);
    line 4: $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
    line 5: $uri = substr($uri, strlen($installPrefix)) ?: '';
    line 6: $uri = ltrim($uri, '/');
    line 7: 
    line 8: switch (true) {
    line 9: case substr($uri, 0, strlen('_statistics')) === '_statistics':
    line 10:        require_once __DIR__ . '/classes/Statistics.php';
    line 11:        $stats_only = false;
    line 12:       Statistics::ProcessStats($stats_only);
    line 13:         exit(0);
    line 14:       break;
    line 15:        
    line 16:    default:
    line 17:        require_once __DIR__ . '/public/index.php';
    line 18: }
  • Hi Tog,

    Please upgrade your PHP version to 5.3 or later. Read Newscoop 4.2 requirements here: http://sourcefabric.booktype.pro/newscoop-42-for-journalists-and-editors/system-requirements/


  • Thank you. I have upgraded to php 5.5 and the installation screen is now visible. I can get as far as the database connection set up screen and then hit another problem. I have correctly entered the parameters for the database, but when I click next the screen just goes completely blank (white), when it should take me to the next step.

    Regards

    Tog
    Post edited by Tog Porter at 2014-09-15 19:23:28
  • Most likely you can find you server log here by default: /var/log/apache2/error.log

    Go through Newscoop install process again and then just execute command: sudo tail -f /var/log/apache2/error.log and paste logs here. It's probably htaccess issue but let's find out.

    Best,
  • Sorry, I don't know what you mean by "execute command".

    I do not have my own server,  I am using an on-line hosting package at 123-reg.co.uk

    I tried putting that line into the browser address bar but it just gave me a Google search results page.


    Best Regards

    Tog
  • Well, you need connect to your server via SSH. Shared hostings usually dont provide this access.. you should ask your provider about this access.

    Or you should get VPS and isntall Newscoop there


    Best,
  • Oh dear. 

    That cloud service costs £70 a month extra, so I guess I will not be using Newscoop after all. 

    I will have a look at other open source CMS packages that will run on my existing hosting package. 

    Thank you for your help.


    Best wishes

    Tog Porter
  • Well, you can run one of these VPSes https://www.digitalocean.com/pricing/ the cheapest one is for $5/month and for testing newscoop it's enough :) but you will have to set up apache and php, depends whoch OS u choose for your VPS.

    Best,
    Post edited by Rafał Muszyński at 2014-09-16 16:45:33
  • You can probably get the log file from your web hotel if you ask them nicely. Other things you can try is to edit the .htaccess file to get a custom log file in a directory you (but not everyone) have access to or (not recommended for security reasons) make the web server display the error message in the browser.