Hello,
I just downloaded 4.0 and am having problems. I am using chrome browser with windows ten. I got through the install process and had some errors on two path names but managed to get those fixed now I am getting errors on the bootstrap.
Fatal error: Class 'Cookie' not found in C:\xampp\htdocs\UserSpice4.0.0\core\init.php on line 70
I went through the init.php file can not figure out what is wrong. I commented those lines out and got the same error for the DB class.
I proceeded to download 3.3 and it seems to work fine. Any help would be great.
Thanks James Eyrich
For some reason your classes are not autoloading, which seems to me like a path issue. Here's how that path thing should look...
function env($type='server'){
if($type == 'server'){
if($_SERVER['HTTP_HOST'] == 'localhost'){
return $_SERVER['DOCUMENT_ROOT'].
'us4/';
}else{
return $_SERVER['DOCUMENT_ROOT'].
'us4/';
}
}else{
if($_SERVER['HTTP_HOST'] == 'localhost'){
return
'us4/';
}else{
return
'us4/';
}
}
}
See above there are 4 places that say us4/ ? If you are on a live server for example, all four of those things should either be /yourfolder/ or yourfolder/
It seems like you might not have gotten all 4 of them. I'll be happy to help further if you have issues.
One more thing, I would also rename and get the periods . out of your directory name. PHP could confuse that with concatonenation. What would happen if you renamed that folder us4 and used my example from above? If you're on a live server, you will almost definitely need it to be /us4/ but you could try us4/ also. Don't forget to comment that line 70 back in!
I went through the init.php file and when I did the setup I put the userspice folder in the root directory so it told me to just put / in the path and that seems to be correct. I renamed the userspice4.0.0 to userspice4 but still getting the Cookie class error.
In the apache config, htdocs is your website root folder? I'm not familiar with xampp, but I assume it should have asked you where to put the default website document folder. What path is that?
Yes htdocs is the server root folder and the url to get to that is localhost/userspice4/index.php, the actual path is C:\xampp\htdocs\userspice4\index.php.
okay, so then what did you enter for your path during setup? You should set it according to the webserver root. Since it is installed in /userspice4/ then you should enter that when it asks for the path. You can either drop the tables and start again, or you can try editing the core/init.php file and make the changes to the path settings as follows. As mudmin pointed out, those places need to reflect the path relative to the web root.
function env($type=’server’){
if($type == ‘server’){
if($_SERVER[‘HTTP_HOST’] == ‘localhost’){
return $_SERVER[‘DOCUMENT_ROOT’].
‘/userspice4/’;
}else{
return $_SERVER[‘DOCUMENT_ROOT’].
‘/userspice4/’;
}
}else{
if($_SERVER[‘HTTP_HOST’] == ‘localhost’){
return
‘/userspice4/’;
}else{
return
‘/userspice4/’;
}
}
}
And just adding...
If you installed it on a live server (let's say userspice.org) then the path is /
If you installed it in a subfolder like userspice.org/demo then the path is /demo/
About the only time you don't put the first / is if you're on a localhost like WAMP. I forget what I had to put for XAMPP.
Finally, the reason for the path being in there 4 times is that the system can detect whether you are on localhost vs a live server and those two things can be in different folders... If you're doing something advanced you're welcome to do that, but I usually say keep it the same for simplicity sake.
The leading / probably just has to do with how windows handles absolute versus relative paths. Not that I know the answer for why...
That's definitely it. The fortunate thing is that if you're wrong, the error message shows the path and it's usually pretty obvious.