-
PHP Fatal error: Call to a member function read () on a non-object in \ zc_install \
site URL: www.toscanadamare.eu ZC version: 1.5.5 , list of plugins, PHP version 5.6.3,
hi, I am installing the 1.5.5 zen cart version and the installer don't start, this is the error:
PHP Fatal error: Call to a member function read () on a non-object in \ zc_install \ includes \ classes \ class.systemChecker.php on line 600
This is a portion of the class.systemChecker.php file containing the line 600:
594 static function getAdminDirectoryList()
595 {
596 $adminDirectoryList = array();
597
598 $ignoreArray = array('.', '..', 'cache', 'logs', 'installer', 'zc_install', 'includes', 'testFramework', 'editors', 'extras', 'images', 'docs', 'pub', 'email', 'download', 'media');
599 $d = @dir(DIR_FS_ROOT);
600 while (false !== ($entry = $d->read())) {
601 if (is_dir(DIR_FS_ROOT . $entry) && !in_array($entry, $ignoreArray))
602 {
603 if (file_exists(DIR_FS_ROOT . $entry . '/' . 'banner_manager.php'))
604 {
605 $adminDirectoryList[] = $entry;
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Remove the @ in @dir on line 599 and see what the error is. I suspect it can't obtain a directory listing due to some restrictions in your server's configuration.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
I removed @ at 599 line and this is the error
PHP Warning: dir(D:\inetpub\webs\toscanadamareeu\,D:\inetpub\webs\toscanadamareeu\): Access is denied. (code: 5) in D:\inetpub\webs\toscanadamareeu\zc_install\includes\classes\class.systemChecker. php on line 599
PHP Warning: dir(D:\inetpub\webs\toscanadamareeu\): failed to open dir: Permission denied in D:\inetpub\webs\toscanadamareeu\zc_install\includes\classes\class.systemChecker. php on line 599
PHP Fatal error: Call to a member function read() on boolean in D:\inetpub\webs\toscanadamareeu\zc_install\includes\classes\class.systemChecker. php on line 600
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Probably best to report this issue to your hosting company, because they're the ones who control permission for that. They can fix the Access Denied issue.
Most likely your user account doesn't have the usual required permissions to allow scanning the list of files in the directory.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
I have a similar problem when trying to upgrade to ver 1.5.5 on an IIS server. The root of this problem in my case is, I believe, the DIR_FS_ROOT constant which is derived somehow from the DIR_FS_CATALOG. The logs show this error report:
[27-Jun-2018 17:26:03 America/Los_Angeles] PHP Fatal error: Uncaught Error: Call to a member function read() on boolean in
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\includes\classes\ class.systemChecker.php:607
Stack trace:#0 C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\includes\modules\ pages\index\header_php.php(12): systemChecker::getAdminDirectoryList()#1 C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\index.php(36): require('C:\\HostingSpace...')#2 {main} thrown in C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\includes\classes\ class.systemChecker.php on line 607
In configure.php I define DIR_FS_CATALOG thusly: define('DIR_FS_CATALOG', '/C:/HostingSpaces/ergonicauser1/ergonica.com/newroot/');
In my research it looks like the CATALOG and ROOT should be the same, but I have not been able to find any place in the code where this is defined. Somehow the functions create the DIR_FS_ROOT as ‘C:\\HostingSpace...’ . I have even tried to define it by adding code in the configure.php files, but it doesn’t work. The installation fails because it is looking for a folder that does not exist.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Is your DIR_FS_CATALOG really set as define('DIR_FS_CATALOG', '/C:/HostingSpaces/ergonicauser1/ergonica.com/newroot/');? What happens if you remove that leading /?
The \\ characters that you're seeing are due to the fact that you're running on a Windows server, so the forward-slashes in the directory tree are changed to back-slashes, which need to be 'escaped' for use, thus the double-backslash.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
I have tried to use the configuration without that leading / and the results are the same. Notice that DIR_FS_CATALOG is correctly represented in the error log several times without the escaped slash. Only the DIR_FS_ROOT is escaped for some reason.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
It would be very helpful if someone can inform us of exactly where in the code the constant FS_DIR_ROOT is defined? As I stated above, this is for version 1.5.5b on an IIS server.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
That's located on line 29 of /zc_install{renamed}/index.php:
Code:
define('DIR_FS_ROOT', realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR);
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
lat9
That's located on line 29 of /zc_install{renamed}/index.php:
Code:
define('DIR_FS_ROOT', realpath(__DIR__ . '/../') . DIRECTORY_SEPARATOR);
In my experiments, I've learned that I can substitute 'C:/' for __DIR__ in this case and still get the same error. So with the .'/../' that follows, is this looking for a folder at the higher level that includes the current folder as the root? Please pardon my ignorance.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
That definition is (attempting) to set the 'root' directory for the store based on the assumption that the zc_install directory is a direct sub-directory of your store's "base". Essentially, that code says
From the directory I'm currently in (presumed to be zc_install), go up one directory level (the ../) and let's consider that the file-system 'root' for this installation.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
lat9
That definition is (attempting) to set the 'root' directory for the store based on the assumption that the zc_install directory is a direct sub-directory of your store's "base". Essentially, that code says
From the directory I'm currently in (presumed to be zc_install), go up one directory level (the ../) and let's consider that the file-system 'root' for this installation.
Yes, that's what I thought. But it's not doing that. Instead it's going to the full directory structure and looking for a root above that. I have tried to force feed it in my tests:
* blank screen no log define('DIR_FS_ROOT', realpath(__DIR__ . '/ergonica.com/') . DIRECTORY_SEPARATOR);
* blank screen no log define('DIR_FS_ROOT', realpath(__DIR__ . '/newroot/') . DIRECTORY_SEPARATOR);
These efforts didn't work. This is the full directory structure: C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\ . So what it should be looking for is ergonica.com, the root of newroot. This application has no rights or permissions for folders or files above newroot. Apparently systemChecker::getAdminDirectoryList() requires this root. I don't know if it's required anywhere else. The error log includes require('C:\\HostingSpace...') which I believe translates to C:\(null)\HostingSpace...
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Create and then run a teeny .php file in /zc_install containing
Code:
<?php
echo __DIR__;
What gets displayed?
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
lat9
Create and then run a teeny .php file in /zc_install containing
Code:
<?php
echo __DIR__;
What gets displayed?
As I stated before: In my experiments, I've learned that I can substitute 'C:/' for __DIR__ in this case and still get the exact same error. So __DIR__ is defined somewhere as 'C:/' in my case. There must be another function or constant that defines the directory structure applied here below __DIR__. The most obvious suspect to me was DIR_FS_CATALOG . I have tried to reduce this constant in both configure.php files to lower levels such as define('DIR_FS_CATALOG', '/HostingSpaces/ergonicauser1/ergonica.com/newroot/'); down to define('DIR_FS_CATALOG', '/newroot/'); and the results are the same. Somewhere another constant is defined or some function governs this process. Apparently this is not compatible with the file structure of my rented Windows server. I am searching for another constant or function that may contribute to this discrepancy. I do appreciate your dialog. I need help. My shopping cart is offline and this is my peak season.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
raycruzer
Yes, that's what I thought. But it's not doing that. Instead it's going to the full directory structure and looking for a root above that. I have tried to force feed it in my tests:
* blank screen no log define('DIR_FS_ROOT', realpath(__DIR__ . '/ergonica.com/') . DIRECTORY_SEPARATOR);
* blank screen no log define('DIR_FS_ROOT', realpath(__DIR__ . '/newroot/') . DIRECTORY_SEPARATOR);
These efforts didn't work. This is the full directory structure: C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\ . So what it should be looking for is ergonica.com, the root of newroot. This application has no rights or permissions for folders or files above newroot. Apparently systemChecker::getAdminDirectoryList() requires this root. I don't know if it's required anywhere else. The error log includes require('C:\\HostingSpace...') which I believe translates to C:\(null)\HostingSpace...
Why is it thought that it should be looking for:
C:\HostingSpaces\ergonicauser1\ergonica.com\
Instead of:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\
?
Let's take the construct one step at a time.
__DIR__ is to represent the current directory.
The current directory for index.php is:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install
One directory up from there can be found by use of the double period or one could try to find the last instance of the directory separator, remove everything from that point to the end but even then there may be other reasons or issues, so instead a function is used that basically figures it all out: realpath.
Realpath determines what the actual path name is based on following whatever links/directions are provided to then generate the path that results, which ideally should be:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot
And then to set things straight the directory separator is applied to be able to append any filename or folder name after that.
Couple of things. One, this is based on the zc_install directory being located as described above. Two, that the directory above the zc_install directory (newroot) is where the catalog's index.php file is located, is also the directory that contains the renamed admin directory, has ipn_main_handler.php etc... Three, and this is perhaps the important part in all this considering that the direct question asked about echoing __DIR__ was ignored is that for the function realpath to work correctly and not return a value of false (boolean), is that the running script must have executable permissions on all directories in the hierarchy.
I base this last issue as a factor because of the statement that the same error occurs if the path is set to the root of the computer or to the directory just above the directory from where zc_install is executed.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
mc12345678
Why is it thought that it should be looking for:
C:\HostingSpaces\ergonicauser1\ergonica.com\
Instead of:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\
?
Let's take the construct one step at a time.
__DIR__ is to represent the current directory.
The current directory for index.php is:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install
One directory up from there can be found by use of the double period or one could try to find the last instance of the directory separator, remove everything from that point to the end but even then there may be other reasons or issues, so instead a function is used that basically figures it all out: realpath.
Realpath determines what the actual path name is based on following whatever links/directions are provided to then generate the path that results, which ideally should be:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot
And then to set things straight the directory separator is applied to be able to append any filename or folder name after that.
Couple of things. One, this is based on the zc_install directory being located as described above. Two, that the directory above the zc_install directory (newroot) is where the catalog's index.php file is located, is also the directory that contains the renamed admin directory, has ipn_main_handler.php etc... Three, and this is perhaps the important part in all this considering that the direct question asked about echoing __DIR__ was ignored is that for the function realpath to work correctly and not return a value of false (boolean), is that the running script must have executable permissions on all directories in the hierarchy.
I base this last issue as a factor because of the statement that the same error occurs if the path is set to the root of the computer or to the directory just above the directory from where zc_install is executed.
I must correct myself for making my assumption about __DIR__. I did the echo __DIR__ as you suggested and got this:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install . Then I echoed __FILE__ and saw this: C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\test.php . As you know, the statement above is
if (!defined('__DIR__')) define('__DIR__', dirname(__FILE__)); So it's looking for dirname() which includes the entire hierarchy, as you say, but that includes levels where we have no permissions and includes directories above and beyond my hosting space. How can we fix that?
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Also, when I echo realpath(dirname(__FILE__) . '/..' , I get C:\HostingSpaces\ergonicauser1\ergonica.com\newroot . This seems to be correct but does not explain the error, unless it expects permissions in ergonica.com.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
raycruzer
I must correct myself for making my assumption about __DIR__. I did the echo __DIR__ as you suggested and got this:
C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install . Then I echoed __FILE__ and saw this: C:\HostingSpaces\ergonicauser1\ergonica.com\newroot\zc_install\test.php . As you know, the statement above is
if (!defined('__DIR__')) define('__DIR__', dirname(__FILE__)); So it's looking for dirname() which includes the entire hierarchy, as you say, but that includes levels where we have no permissions and includes directories above and beyond my hosting space. How can we fix that?
Fix what? DIR_FS_ROOT is to be the full path from the base of the server to the location of question. It is not a "relative" link from the webspace.
To continue on with the test. Now that echo __DIR__ has provided a reasonable result, would suggest echoing the next parts:
Code:
echo __DIR__ . '/../';
echo "\n";
echo realpath(__DIR__ . '/../');
I'm not seeing how the if not defined __DIR__, then define __DIR__ has anything to do with this issue.
If the teeny test.php file were generated as requested to have just 2 lines in it and you achieved the posted result of having a value for __DIR__, then the discussed line in the previous post about defining __DIR__ isn't even executed nor relevant.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Just in case it's a permission question, I created a new folder in newroot and moved everything down to that level. Then I reconfigured my configure.php files and ran the install program. I actually got past the point of errors and progressed to the next step of updating my database, which is actually a new and empty database. Here I have a different problem because the program wants the Admin superuser for this database which doesn't exist. Can't seem to get around this issue since it seems that the install program is looking at information from my old database and assumes that this new store is already established, which is not true. I am trying to upgrade my old store, but this is a new install for testing. And, by the way, I really appreciate your help.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
I suppose I could point this install to my old database, but I wan't sure if my data from several years of activity would be safe. Yes, I did back it up.
-
Re: PHP Fatal error: Call to a member function read () on a non-object in \ zc_instal
Quote:
Originally Posted by
raycruzer
I suppose I could point this install to my old database, but I wan't sure if my data from several years of activity would be safe. Yes, I did back it up.
So yes, things are in an odd condition now. To perform this testing that you seem to be trying (which is good to do such testing while the site is live though not on anything that would affect the live site).
So, if you are following this FAQ: http://www.zen-cart.com/entry.php?3-...d-of-upgrading
Then, at this point you really should be trying to install 1.5.5f to a new database that is to use the same DB_PREFIX as your live site and perhaps ideally with the demo product so that you can see what it would look like and walk yourself through the upgrade process of the software and what may be necessary from plugins and other modifications to make... this install would be a new install to the new database meaning as you step through the zc_install process the first time it would be to install the program to the new database not to do an upgrade of any previous/other database.
At the time it is desired to see the upgrade of the database occur, then you would be copying the database from your live site and replacing the database of this upgrade site... at which point you would upload and run zc_install again this time to upgrade the database...
What this means is that when looking at the includes/configure.php files of the live site and of this new upgrade site, the DB_PREFIX should be the same in both, but the database should be different even if the username/password are the same (or different)... the same difference should be seen between the live site's and the new site's admin/includes/configure.php. And when looking at the includes/configure.php and admin/includes/configure.php files of the new site, the db information should be the same in those two files.