Jump to:

4875 Posts in 6997 Topics by 1472 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2643 Views
  • erparom
    Avatar
    Community Member
    4 Posts

    URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    Hello everybody. I'm currently trying to install SilverStripe in my Ubuntu with many problems and really does not know how to fix them. Please help me with this issue.

    Environment:
    -Ubuntu 9.10
    -LAMP: (XAMPP 1.7.3a: PHP 5.3.1 & MySQL 5.1.41

    At SS install it just stops with the following error:

    Friendly URLs are not working. This is most likely because mod_rewrite isn't configuredcorrectly on your site. Please check the following things in your Apache configuration; you may need to get your web host or server administrator to do this for you:

    * mod_rewrite is enabled
    * AllowOverride All is set for your directory

    Refreshing install.php just happens exactly the same. So I tried looking at ".../home/successfullyinstalled?flush=1" just to verify the installation and the following error appears:


    [Warning] mb_substr_count() expects at most 3 parameters, 4 given
    GET /silverstripe/home/successfullyinstalled?flush=1

    Line 304 in /opt/lampp/htdocs/silverstripe/sapphire/core/control/HTTPRequest.php
    Source

    295       
    296       // Special case for the root URL controller
    297       if(!$pattern) {
    298          return ($this->dirParts == array()) ? array('Matched' => true) : false;
    299       }
    300
    301       // Check for the '//' marker that represents the "shifting point"
    302       $doubleSlashPoint = strpos($pattern, '//');
    303       if($doubleSlashPoint !== false) {
    304          $shiftCount = substr_count($pattern, '/', 0, $doubleSlashPoint) + 1;
    305          $pattern = str_replace('//', '/', $pattern);
    306          $patternParts = explode('/', $pattern);
    307          
    308          
    309       } else {
    310          $patternParts = explode('/', $pattern);

    Trace

    * mb_substr_count(admin/security//$Action/$ID/$OtherID,/,0,14)
    Line 304 of HTTPRequest.php
    * HTTPRequest->match(admin/security//$Action/$ID/$OtherID,1)
    Line 247 of Director.php
    * Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    * Director::direct(/home/successfullyinstalled)
    Line 118 of main.php

    By the way:
    -Of course mod_rewrite is enabled (

    LoadModule rewrite_module modules/mod_rewrite.so

    ) at my httpd.conf
    -Also, I added:

    <Directory "/opt/lampp/htdocs/silverstripe">
    Options FollowSymLinks SymLinksifOwnerMatch
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>


    to the file. (Even I tested with the root directory <Directory /> allowing override All)

    Searching the install.php file of SS, this is the function where things go wrong:

    function checkModRewrite() {
    ...
       if(typeof $ == 'undefined') {
    ...
       } else {
          $.ajax({
             method: 'get',
             url: 'InstallerTest/testrewrite',
             complete: function(response) {
                if(response.responseText == 'OK') {
    ...
                } else { HERES THE PROBLEM
                   $('#ModRewriteResult').html("Friendly URLs are not working. This is most likely because mod_rewrite isn't configured"
                      + "correctly on your site. Please check the following things in your Apache configuration; "
                      + " you may need to get your web host or server administrator to do this for you:"
                      + "<ul><li>mod_rewrite is enabled</li><li>AllowOverride All is set for your directory</li></ul>");

    But I did not found any help in the help site or any similar reference (answered) in the forums. I will really appreciate if someone could help me.

  • erparom
    Avatar
    Community Member
    4 Posts

    Re: URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    Another note:

    I tested the if the rewritenegine works and... it works!

    in the .htaccess file:
    RewriteRule ^testurl$ http://www.google.com/

    and it worked

  • erparom
    Avatar
    Community Member
    4 Posts

    Re: URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    I made a sad discovering...

    According to the error, it reports that mb_substr_count requires 3 params but in fact the function used is substr_count that really uses 4 parameters

    int mb_substr_count ( string $haystack , string $needle [, string $encoding ] )
    int substr_count ( string $haystack , string $needle [, int $offset = 0 [, int $length ]] ) THIS IS THE FUNCTION USED!

    And according to the error:

    [Warning] mb_substr_count() expects at most 3 parameters, 4 given at line 304

    wich content is

    $shiftCount = substr_count($pattern, '/', 0, $doubleSlashPoint) + 1;

    even the trace tells we are using the mb_ function where we are not:

    mb_substr_count(admin/security//$Action/$ID/$OtherID,/,0,14)

    but the line with the mistake its actually

    304- substr_count($pattern, '/', 0, $doubleSlashPoint) + 1;

    mm my last option is to install a Win in my VirtualBox and try from there...

    and---

    THIS IS LAME! silverstripe in windows XAMPP works. I've just installed it, no mistakes
    This sucks, maybe XAMPP for linux or my php.ini are not working correctly

  • banal
    Avatar
    Community Member
    901 Posts

    Re: URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    Maybe you don't have the multibyte string extension compiled into PHP? Could be that SilverStripe then uses the default string functions?
    http://php.net/manual/en/mbstring.installation.php

  • erparom
    Avatar
    Community Member
    4 Posts

    Re: URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    Banal:

    Thanks, you are right. Php in XAMPP for Linux DOES not includes mbstring library and there's (as far as I know) no simple way to add it to the existing installation but to compile php again. Being this the case:

    1-If there's some way to add new extensions (mbstring) to a the XAMPP php implementation, then maybe I still have a chance.

    2-If I should recompile php, then XAMPP for Linux SUCKS and I should uninstall it and use Ubuntu official AMP implementation.

    Thanks for all.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    I don't think there's a way to extend an existing php build without recompiling.

    I suggest you get PHP, Apache and MySQL via your Package manager and configure PHP manually. Or look for a suitable pre-built package.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: URGENT HELP! Friendly URL not working and mb_substr_count() Parameter Errors Link to this post

    Like banal said, probably easier to use your package manager. For Ubuntu, I used Synaptic Package Manager to install MySQL 5, PHP 5.2, all the php 5 extensions I could find, and Apache 2.2. All installed easily and it was already working when browsing to http://localhost

    Synaptic lists PHP 5 separate of the extensions, so you'll need to search for "php" and then individually select the modules like GD, mbstring, mssql etc to install. It's quite modular this way.

    There's a few things you need to do after installing the packages:

    1. Enable mod_rewrite by running "sudo a2enmod rewrite"
    2. Enable AllowOverride All by editing /etc/apache2/sites-available/default and looking for AllowOverride None and replacing "None" with "All"
    3. Rename the sample php.ini file in /etc/php5/apache2 and then set the memory limit inside php.ini to something higher than 16M
    4. Restart apache "sudo apache2ctl restart"
    5. Place SS into /var/www - e.g. /var/www/silverstripe
    6. chmod 777 .htaccess, assets and mysite/_config.php in the SS installation inside /var/www
    7. Browse to http://localhost/silverstripe and the installer should appear

    Cheers,
    Sean

    2643 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.