Closed Zendiver closed 4 years ago
This could happen if the Controller class somehow got included more than once.
Have you modified any of the code?
Without seeing the code that is causing the issue, it is hard to say what the cause of the problem is. If you want to share the code with me, I would be happy to look into the issue more.
Thank you Dave. Which file would you like me to send. I have not made any changes to the original files.
Matter of fact, I downloaded the files again and tried a new dev environment and get the same issue. This happens after the login screen
When I click on Login, I get the following: Fatal error: Cannot redeclare class Controller in E:\websites\com.bailey.survey\controllers\Controller.php on line 17
I have attached the Controller.php file (remove the .txt extension) Controller.php.txt
As a test, I just installed XAMPP and extracted the php-survey-builder files to C:\xampp\htdocs\php-survey-builder
. I went to http://localhost/php-survey-builder and got an error message about sqlite not being enabled:
I enabled this sqlite3 extension in my php.ini file, then I stopped and started apache. Now I am able to log in without any errors:
Do you have any other projects installed with XAMPP? They may somehow be conflicting with the Controller class in php-survey-builder.
The library is enabled on xampp,but the error continue. Probably there are some requirements.
Hi I have the same Error in Wamp Server
Thank you Dave. Which file would you like me to send. I have not made any changes to the original files.
Matter of fact, I downloaded the files again and tried a new dev environment and get the same issue. This happens after the login screen
When I click on Login, I get the following: Fatal error: Cannot redeclare class Controller in E:\websites\com.bailey.survey\controllers\Controller.php on line 17
I have attached the Controller.php file (remove the .txt extension) Controller.php.txt
@hamidionline can you please put this code at the top of Controller.php, and let me know the result?
$reflector = new ReflectionClass('Controller');
echo $reflector->getFileName();
exit;
Return the phisical route to Controller.php class file
Replace require
with require_once
should solve this issue.
Before:
require 'controllers/Controller.php';
After:
require_once 'controllers/Controller.php';
The XAMPP and enabling the sqlite3 from php.ini worked for me! I really liked your work or how can we migrate from sqlite3 to mysql. Thank you
@smixy it should be pretty easy to get this working with MySQL instead of SQLite3. First, make sure data/schema.sql is compliant with MySQL. Next, update the DSN in configs/Database.ini. Finally, modify the openDatabase() function in controllers/Controller.php so that 'filename' isn’t a required setting.
@phpdave11 i got this error PDOException: SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)
@smixy some extra code was needed to pass in the username and password to PDO. Version 1.1.0 fixes this.
@phpdave11 Everything is working now, Thank you for your efforts.
Hi, I have set up the Survey Builder on a Windows 10 Server using IIS Fastcgi. I have tried both php5 and php7 and get the same error result as mentioned above:
I have enabled sqlite3 and the login page works.
When I click on Login, I get the following: Fatal error: Cannot redeclare class Controller in C:\inetpub\wwwroot\PHP\PHPSurvey\controllers\Controller.php on line 17
I tried this: Replace require with require_once should solve this issue.
Before: require 'controllers/Controller.php'; After: require_once 'controllers/Controller.php';
note this require appears in several files, I have tried changing all of them to require_once. If I change require to require_once I get the following error: PHP Fatal error: Class 'Login' not found in C:\inetpub\wwwroot\PHP\PHPSurvey\controllers\LoginController.php on line 28
anyone any further ideas?
@damacreg can you please put this code at the top of Controller.php, and let me know the result?
$reflector = new ReflectionClass('Controller');
echo $reflector->getFileName();
exit;
Hi Dave,
Here is the result:
C:\inetpub\wwwroot\PHP\PHPSurvey\controllers\Controller.php
Kind Regards
Eddie
Hi Dave,
Thanks, does this work with PHP 7 or only 5
Kind Regards
Eddie
It works on both PHP 7 and PHP 5 (version 5.4 or higher).
Hi Dave,
I’m trying it on php 7.3.1 and whichever page I try to access it goes to http://localhost/PHPSurvey/login.php and I just get a blank screen,
Any ideas?
No errors show up in chrome developer tools
Kind Regards
Eddie
Hello Dave,
Trying to use the new php survey builder 1.1.1 but I am getting a blank scree on login page
@damacreg @geoffreynzomo the blank screen on login page bug has been fixed in v1.1.2
That's great thanks, it is working now
Thanks Dave, its fine now.
Sorry, I am also somewhat of a newbie. I am running XAMPP and all my other projects are running fine but when I add a new project dev.suryvey.zendiver.net, I get the following error:
Fatal error: Cannot redeclare class Controller in D:\wamp\www\net.zendiver.survey\controllers\Controller.php on line 17
I have made sure the data/ file was writeable.
Thank you in advance