[SOLVED] Warning: preg_match(): Unknown modifier '/' in core/Url.php on line 226

On a fresh 1.11.1 installation, all I did was to change the url address of the site hosting piwik.


Warning: preg_match(): Unknown modifier '/' in /home/axil/public_html/stats/core/Url.php on line 226

Backtrace -->

#0 Piwik_ErrorHandler(...) called at [:]
#1 preg_match(...) called at [/home/axil/public_html/stats/core/Url.php:226]
#2 Piwik_Url::isValidHost(...) called at [/home/axil/public_html/stats/core/Url.php:271]
#3 Piwik_Url::getHost(...) called at [/home/axil/public_html/stats/core/Url.php:302]
#4 Piwik_Url::getCurrentHost(...) called at [/home/axil/public_html/stats/core/Url.php:63]
#5 Piwik_Url::getCurrentUrlWithoutFileName(...) called at [/home/axil/public_html/stats/core/Piwik.php:173]
#6 Piwik::getPiwikUrl(...) called at [/home/axil/public_html/stats/plugins/API/API.php:499]
#7 Piwik_API_API->getSVGLogoUrl(...) called at [/home/axil/public_html/stats/core/Controller.php:482]
#8 Piwik_Controller->setBasicVariablesView(...) called at [/home/axil/public_html/stats/plugins/Login/Controller.php:97]
#9 Piwik_Login_Controller->configureView(...) called at [/home/axil/public_html/stats/plugins/Login/Controller.php:85]
#10 Piwik_Login_Controller->login(...) called at [/home/axil/public_html/stats/plugins/Login/Controller.php:45]
#11 Piwik_Login_Controller->index(...) called at [:]
#12 call_user_func_array(...) called at [/home/axil/public_html/stats/core/FrontController.php:136]
#13 Piwik_FrontController->dispatch(...) called at [/home/axil/public_html/stats/core/Controller.php:727]
#14 Piwik_Controller->redirectToIndex(...) called at [/home/axil/public_html/stats/plugins/CoreHome/Controller.php:41]
#15 Piwik_CoreHome_Controller->redirectToCoreHomeIndex(...) called at [:]
#16 call_user_func_array(...) called at [/home/axil/public_html/stats/core/FrontController.php:136]
#17 Piwik_FrontController->dispatch(...) called at [/home/axil/public_html/stats/index.php:52]

Now I can’t even login and there is a new message as well


Error: You must call Zend_Session::regenerateId() before any output has been sent to the browser; 
output started in /home/axil/public_html/stats/libs/Zend/Log/Writer/Stream.php/133

What is the URL you have setup as trusted_host in config.ini.php? Remove any trailing slash from the URL if there is one.

There is no trailing slash. I commented out the trusted_hosts and errors disappeared.

Thanks for pointing it out :slight_smile:

What was the value of trusted_host before you commented out? i’m curious if it’s a bug in piwik

[quote=matt]
What was the value of trusted_host before you commented out? i’m curious if it’s a bug in piwik[/quote]

I installed piwik inside a local network with url 192.168.1.30/~username/piwik and this is what was saved as trusted_host. I then tried to change its value through General Settings, so that the fqdn appear at the tracking code and not the lan url. And that’s when the error occured. After reading the faq, I had this option disabled, setting enable_trusted_host_check = 0.

If you think there is a bug, tell me what other info I can provide that will be useful :slight_smile:

No this is not a bug, but a misconfiguration. trusted_hosts only takes the hostname and not the absolute URL. So in your case you need to set it to


[General]
trusted_hosts[] = 192.168.1.30

I just changed it back to 192.168.1.30 and I got a Warning


Warning: You are now accessing Piwik from http://domain.com/~username/piwik/, but Piwik has been configured to run at this address: http://192.168.1.30/~username/piwik/.

Fact is, I haven’t read any faq/documentation yet, so maybe this is somewhere documented.
Thanks for you time.

Needs to be the domain you’re using of course. Just got the IP from your previous post.

there is no question that i don’t have the right Piwik URL or Piwik path (PHP API, beta). i know that.

have tried SEVERAL variations in piwik itself and in the setup for “wp-piwik” to no avail. in trying to rename my trusted hostname (maybe add a /piwik to the filename to get the dang thing to work) i got the same catastrophe that the others above have gotten. but i am not a programmer. just a hard working baby mama whose cpanel is down right now…and i don’t know how to get back into my piwik installation. i know how to CommentThings Out, but right now i can’t even get to where i see some code.

i read and read and read and nothing makes sense (and variations are not successful)

  1. how are you getting back into your installations after they crash into oblivion? i need explicit detail. i’m a 404 on the cpanel.
  2. this is the biggest pain—>>>what is the correct format for the “trusted hostname”?. apparently, www.mydomain.com ain’t it. neither is mydomain.com. neither is hpps://mydomain.com/piwik (<-after getting an SSL). and neither is www.mydomain/piwik because that renaming effort crashed the whole thing. have tried other variations as well from reading other forum postings. still ain’t workin.
  3. what is the correct format once you get to the WP-Piwik plugin? namely, Piwik URL (REST API): www.whattheheckgoeshere.com and whatever else IN EXPLICIT DETAIL goes here --and also Piwik path (PHP API, beta): www.whatgoeshere.com <- in other words, where is the place to get the answer.

i loaded this whole thing on one domain (reseller). it’s behind the public html. now what?

i would appreciate any divine inspiration…

many thanks.