Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Can't Sign in to Admin on Localhost

edited October 2013 in Install Help

I've come back to Elefant after being busy with some other things. I had a fully functional localhost install of Elefant 1.3.4 running on MAMP 2.1 about 6 months ago.

Since then I upgraded to MAMP 2.2 on my MacBookPro (OSX 10.8.5). I can install Elefant 1.3.6 successfully (the installer puts me into the Home page of a fresh site), but when I go to sign in with my email/password, the admin bar never shows up.

I've tried ZIP, Github, and command-line install, plus Chrome, Opera, Safari, and Firefox. Searching system logs I found:

[30-Oct-2013 08:47:30 GMT] PHP Fatal error:  Uncaught exception 'ErrorException' with message 'preg_replace(): The               /e modifier is deprecated, use preg_replace_callback instead' in /lib/Template.php:346
Stack trace: 
[internal function]: Debugger::handle_error(8192, 'preg_replace():...', '/Applications/M...', 346, Array)
/lib/Template.php(346): preg_replace('/\{\{ ?(.*?) ?\...', '$this->replace_...', '<form method="P...')
/lib/Template.php(288): Template->parse_template('<form method="P...')
/apps/admin/handlers/index.php(35): Template->render('admin/index')
/lib/Controller.php(444): require('/Applications/M...')
/index.php(152): Controller->handle('apps/admin/hand...', false) 
thrown in /lib/Template.php on line 346

Googling preg_replace() led me to believe it could be a PHP 5.5 issue, but it happens with 5.4 and 5.3 as well, and both SQLite and MySQL.

I found a Github bug report with the exact same situation here. There is one cookie being set by the site, if that helps:

Name:   has_js
Content:    1
Domain: elef
Path:   /
Send for:   Any kind of connection
Accessible to script:   Yes
Created:    Wednesday, October 30, 2013 2:34:32 AM
Expires:    When the browsing session ends

I believe I'm doing the right thing with .htaccess, but let me check:

  • ...mod_rewrite is enabled, though Elefant's file specifies a .c extension while MAMP's Apache uses .so
  • the downloaded .htaccess is sitting in Elefant's directory, which is installed in MAMP's htdocs folder
  • there are some other CMS installed in the same htdocs folder that work fine (ProcessWire, Omeka, TextPattern, WordPress)...however Drupal is having the same issue as Elefant (installs but can't successfully sign in). I re-installed MAMP and added Elefant first, this still happens so I don't think it's interference from something else. My successful 1.3.4 install had the same setup (shared virtualhost folder with etc/hosts and -vhosts.conf entries) and was fine.

One more question, I want to check out PHP Composer. Does it install a development server and database as per-project dependencies, or do I still have to use MAMP? When installing frameworks/CMS with Ruby's and Python's dependency managers (RVM and Virtualenv, respectively), a development server/database is included, so it's truly a self-contained setup. Wondering if Composer's the same.



  • The preg_replace() error was fixed just after 1.3.6. Try pulling the latest source from the master branch on Github and let me know if that works. If not, usually when a cookie won't set in local development it's because of using a domain like localhost instead of an alias like, so that would be the next thing I'd check.

    Composer just installs PHP libraries, so it won't auto-install dependencies beyond that. However technically PHP has its own built-in web server (as of 5.4, run php -S localhost:8080 -t . index.php to start it with Elefant), and its own built-in database (SQLite). But usually PHP runs behind a web server daemon like Apache or Nginx, so its built-in web server is meant more for development/testing.

  • Thanks so much, setting it up with www.mysite.lo alias did the trick!

Sign In or Register to comment.