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.