Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
937 views
in Plugins by

I have been using the plugins in the Q2A directory as well as creating our own for quite some time. Never had any problems. Recently, whenever we create new plugin, we get a PHP error as follows:

PHP Warning:  require_once(/qa-plugin/NAMEOFPLUGIN/NAMEOFPLUGINFILE.php): 
failed to open stream: No such file or directory in qa-include/qa-base.php on 
line 632, referer: qa/admin/plugins

We have tested this with our plugins, as well as other plugins in the directory and the error is always present, so it's not an issue with code. Our existing plugins work fine, we just can't add any new plugins.

Is there a limit to the number of plugins you can use on a site?

By the way, we also get this error along with the above error:

PHP Parse error:  syntax error, unexpected '-', 
expecting '{' in qa-plugin...

This again seems like a code error, but it's not. No matter what you do, Q2A will not read a new plugin. Basically, Q2A won't read the Class file that is used in plugin and it throws the above error.  We've used proven existing plugins and new plugins, to make sure there is no coding error, and the error is still thrown.

 

 

 

by
How many plugins do you need to see this problem?
by
I have 18 plugins now. It failed on the 19th.

The plugins that have failed to work (not a coding issue, as I've check the code dozens of times and the plugins work fine on other Q2A sites), are Event plugins.

2 Answers

0 votes
by
I tested this on my installation. 20 plugins so far and no errors at all.

If it's not finding a particular file, maybe it could be some problem with permissions on your server?
by
Nope not a problem with permissions. Checked that (and the site works fine up to a certain number of plugins). There is some sort of bug when it comes to Event plugins. In fact, when you place the code for the new Event plugin in an existing plugin that functions and has been "registered" already, everything works fine. It's only as a new plugin that the system fails. So apparently, there is a bug somewhere calling new Event plugins.

As a workaround, I just stopped developing any new plugins and just place all my code in one plugin. That's the only way it works.
by
If it always breaks on 19 plugins, something else you could try is going to 20 plugins, then remove one at a time to see if that fixes the issue.
Do any of the plugins use the same class name? Do you have any plugins that are huge or do something that could be a memory issue?

Could you also post the code surrounding that parse error there?
0 votes
by
This is not an internal Q2A limitation. Based on your description it sounds most likely to be a bug in the PHP version you're using?
by
I am not so sure. I have tested this on different servers and banged my head against the wall many times. No luck. I've given up. The PHP code is fine (the plugins are actually plugins that work and are listed in the plugin section on Q2A). Something weird happens with Q2A when you have multiple Event plugins. The system fails. There is no real syntax error, and the main error you get is:

PHP Warning:  require_once(/qa-plugin/NAMEOFPLUGIN/NAMEOFPLUGINFILE.php):
failed to open stream: No such file or directory in qa-include/qa-base.php on
line 632, referer: qa/admin/plugins

This implies that qa-base.php is not finding the plugins, even though they are there. This is a bug in Q2A.

Anyway, I've given up on this for now. When I have the time, I will post the code.
...