I've got an issue where I moved the whole folder into a server WITH the vendor files and everything, and it's not loading the classes anymore, while the localhost/local copy is working ok. What might be the problem?
The error code is unnecessary, but I'm adding it anyway..
Fatal error: Uncaught Error: Class 'Google_Service_Adsense' not found in /home/user/full/path/of/the/file/where/its/located
the files are unchanged, only moved into the server. Composer is not in the server, and it's a managed server so no ability to install and update the package or composer either.
composer.json:
{ "require": { "google/apiclient": "^2.0", "google/apiclient-services": "^0.68.0" } }
filepath where the classfile should reside:
myDirectory\vendor\google\apiclient-services\src\Google\Service\AdSense.php
the link where it actually resides in the github repo:
https://github.com/google/google-api-php-client-services/blob/master/src/Google/Service/AdSense.php
update:
after deleting the whole thing from the server and reimporting I'm getting this error:
Fatal error: require(): Failed opening required '/home/user/full/path/of/the/file/where/its/located/vendor/composer/../guzzlehttp/psr7/src/functions_include.php' (include_path='.:/usr/share/pear') in /home/user/full/path/of/the/file/where/its/located/vendor/composer/autoload_real.php on line 66
second update. After removing the directory with the contents from the server once again, uploading a ziped archive, unzipping it I'm still left with the first fatal error.
After struggling for more than I should have with different types of file upload and unextraction I manually loaded the file where the class was located (even though I shouldn't need to do that in my opinion )
like:
require_once __DIR__ . '/vendor/google/apiclient-services/src/Google/Service/AdSense.php';
and it started working.
Related
I have an activity plugin that requires another plugin to work correctly.
I followed the recommendation of requesting this plugin as a dependency in the version.php file like this :
$plugin->dependencies = array('local_aws' => 2017071501 ); //AWS php SDK dependency
The problem is when I install my plugin I receive a Warning :
Warning:
require_once(/var/www/moodle/local/aws/sdk/aws-autoloader.php): failed
to open stream: No such file or directory in
/var/www/moodle/mod/tutorship/lib.php on line 37
Fatal error: require_once(): Failed opening required
'/var/www/moodle/local/aws/sdk/aws-autoloader.php'
(include_path='/var/www/moodle/lib/pear:.:/usr/share/php') in
/var/www/moodle/mod/mymodulep/lib.php on line 37
Line 37 uses this code:
// For AWS API Part
require_once($CFG->dirroot . '/local/aws/sdk/aws-autoloader.php');
So it seems to me during the install of my plugin the require_ once is not being satisfied as the AWS plugin has yet to be installed. Well I followed the recommendation of making it a dependency in version.php but it isn't being installed before the require_ once is checked ?
How can I resolve this conundrum ?
I think you are right in your supposition that "require_ once is not being satisfied as the AWS plugin has yet to be installed". To avoid this kind of problem, you should try to avoid to require files of other plugins/libraries in lines that are actually executed during the plugin installation/upgrading procedures. Is it necessary to use the other plugin during the installation of yours?
I would move the require_once($CFG->dirroot . '/local/aws/sdk/aws-autoloader.php'); to some file that is never run during the actual installation/upgrading (avoid the header of lib.php). For example, I would create a class mod/tutorship/classes/some_class.php (properly "namespaced" with namespace mod_tutorship;), do the require_once there and then just instantiate the class in my lib.php within the function that actually needs it.
I'm getting this error when my site is online
[host www.sitename.com] Backend fatal error: PHP Fatal error: require_once() [function.require]: Failed opening required 'admin/config/connection.php' (include_path='.:/opt/cpanel/ea-php53/root/usr/share/pear:/opt/cpanel/ea-php53/root/usr/share/php') in /home/mistrybu/public_html/index.php on line 373\n
The site works well in localhost but when its put online , the dynamic part is not showing.
I changed the php version from php7 to php5 in cpanel. Now the front end is working but the backend is not.
Can someone help me solve this error?
PHP version
Definitely do not go back to PHP5. Keep it to 7. If that means rewriting some of the existing code, so be it, it will make your site more secure and more future proof.
Error Message
Your require_once() method cannot find or access a particular file. This is most probably because:
File missing
The file (connection.php) doesn't exist in the given location (admin/config). Now keep in mind that as the location doesn't start with a /, it's going to be relative to where the require_once() method is being run from.
Since you're running require_once() from:
home/mistrybu/public_html/
it's going to look for the file here:
/home/mistrybu/public_html/admin/config/.
Does that location exist? Does the connection.php reside in the folder?
Folder mismatch
Try adding the following prefix to your path, and see if that makes a difference:
require_once $_SERVER['DOCUMENT_ROOT'].'/admin/config/connection.php';
File errors
Maybe the file exists, but for some reason, gives an error. Try running the following from your command line and see if you get any errors:
php -f admin/config/connection.php
I've updated my mediawiki from 1.26.2 to 1.27, the installation process finished ok, but when I try to access I received this error:
Warning:
require(/var/app/current/includes/specials/SpecialUserLogin.php):
failed to open stream: No such file or directory in
/var/app/current/includes/AutoLoader.php on line 81 Fatal error:
require(): Failed opening required
'/var/app/current/includes/specials/SpecialUserLogin.php'
(include_path='/var/app/current/vendor/pear/pear_exception:/var/app/current/vendor/pear/console_getopt:/var/app/current/vendor/pear/pear-core-minimal/src:/var/app/current/vendor/pear/mail_mime:/var/app/current/vendor/pear/mail_mime-decode:/var/app/current/vendor/pear/net_socket:/var/app/current/vendor/pear/net_smtp:/var/app/current/vendor/pear/mail:.:/usr/share/pear:/usr/share/php')
in /var/app/current/includes/AutoLoader.php on line 81
I have no idea why is this happening. If I check the files in my server they're there. I'm also having template issues if I choose vector I only get a messed up template, without styling.
I'm using PHP 5.6.
I hope someone can help me.
I just stumbled across this same exact error after upgrading to MW 1.27.
In my case, the SpecialUserlogin.php existed and all of the permissions were right BUT the word login was written in lowercase so the system thought this file didn't exist. So I just renamed the SpecialUserlogin.php to SpecialUserLogin.php and b00m, it worked!
As for your templating issues, check the common.css file. Copy paste everything out of there, so it's empty, if you don't use it. And check that you're calling your style files correctly in your template.
My website directory was moved to another server but the database is still the same. Will this cause an issue on Propel? Because I'm getting this error:
Fatal error: require_once(): Failed opening required
'propel/Propel.php'
(include_path='/www/inc:/var/www/www.samplesite.com/classes:.:/usr/share/php:/usr/share/pear')
in /var/www/www.samplesite.com/config.php on line 7
Or is this error caused by something else, not Propel?
Do I perhaps need to execute a rebuild of the Propel installation in order to correct the paths by itself?
You need to set_include_path() just before you call require_once
While working with PHPExcel in my application I got following errors
In PHPExcel/Autoloader.php file for line “PHPExcel_Shared_ZipStreamWrapper::register();”,
Fatal error: require() [function.require]: Failed opening required '/wamp/www/xxxx/site//common/class/PHPExcel_Shared_ZipStreamWrapper.class.php' (include_path='C:\wamp\www\xxxx\site\common\html_purifier;.;C:\php\pear') in C:\wamp\www\xxxx\site\config\bootstrap.php on line 27
and for line “PHPExcel_Shared_String::buildCharacterSets();”
Fatal error: require() [function.require]: Failed opening required '/wamp/www/xxxx/site//common/class/PHPExcel_Shared_String.class.php' (include_path='C:\wamp\www\xxxx\site\common\html_purifier;.;C:\php\pear') in C:\wamp\www\xxxx\site\config\bootstrap.php on line 27
I'm using wamp with php 5.3.5. and zip xml and gd2 extensions are enable on my local machine.
Please help me for this.
Thanks.
The reference to C:\wamp\www\xxxx\site\config\bootstrap.php suggests you're working with some kind of framework: does it have an autoloader that could be conflicting with or overriding PHPExcel's autoloader?
The reference to
'/wamp/www/xxxx/site//common/class/PHPExcel_Shared_ZipStreamWrapper.class.php'
seems to confirm this.
as something is changing the filename to include ".class" as part of the filename, and it's ignoring PHPExcel's own autoloader that splits a class name to match its directory structure
If you're using a standard framework such as ZF or Symfony, then you should register PHPExcel with that framework. If it's a homebrew, make sure your autoloader is SPL registered
You seem to be having double slashes in your path:
/wamp/www/xxxx/site*//*common
So it's probably a path issue and the autoloader isn't able to load the file because the path is wrong.