Copy link to clipboard
Copied
I'm working through the latest Powers' book adapting it to a site I'm developing and running into several problems deploying the site successfully. For now I'll start with the login function. When I try to log in I get the following messages (haven't turned errors off yet):
Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 5
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 5
The library.php file looks like this:
<?php
// Adjust the path to match the location of the library folder on your system
//$library = 'http:/www.conmolbry.com/ZendFramework/library';
//set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
try {
Zend_Loader_Autoloader::getInstance();
$write = array('host' => 'wfrma.db.5915058.hostedresource.com',
'username' => 'wfrma',
'password' => 'xxxxxx',
'dbname' => 'wfrma');
$read = array('host' => 'wfrma.db.5915058.hostedresource.com',
'username' => 'wfrmaread',
'password' => 'xxxxxx',
'dbname' => 'wfrma');
$dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
$dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
} catch (Exception $e) {
echo $e->getMessage();
}
I'm not sure, but it may be connected to an improper include_path based on my improper interpretation of the instructions in Lesson 13, top of p. 469. I'm using the linux code procedure which I think is ok. What I don't quite understand is what that path though is supposed to look like in reality. The example there is dummy language, but this dummy can't figure out how to get it to point to the location it needs to in my site on the remote server. Should it be of this form: include_path = ".:/php/includes:/www.mysite.com/site root folder ? Need help with that.
Also I found the instructions unclear if the host (in this case GoDaddy) does indeed provide the Zend Framework, how to tap into that correctly rather than upload it to a library folder on my site at all. They gave me instructions to add this code to a php.ini file:
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.3
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3
zend_extension=/usr/local/Zend/lib/Optimizer-3.3.3/ZendExtensionManager.so
zend_extension_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3/ZendExtensionManager_TS.so
,then put the php.ini into the site root. They didn't mention anything about adjusting the include_path in the php.ini too. That all doesn't seem to be working either and I'm a bit baffled now how to either successfully connect to an existing ZF on the GoDaddy remote server, or upload the ZF and make the correct connections using the instructions in lesson 13.
Sorry for this massive confusion and tackling a couple things in one thread. However, it's all related to this singular exercise in the book. I feel if I can overcome these couple hurdles I'll be well on my way. Please let me know what additional information I might add to help with understanding and a solution.
Thanks!
Peter
I'm not sure how I can make this much clearer. The book describes two ways of handling the situation:
It seems that you have the option to change php.ini (or php5.ini in your case). If you don't want to do so, using the first option should work fine.
Having said
...Copy link to clipboard
Copied
Typically an error like the one you displayed means the file cant be found, either the file was not uploaded to the server or you are not pointing the the correct spot.
Your scripts folder, is it scripts or Scripts?
Gary
Copy link to clipboard
Copied
Gary, it's scripts with a small s. I'm really wondering if it's a problem with the include_path in the php.ini file. I don't understand the concept of that at all or how it helps make a connection with the ZF which is housed in a dedicated "library" folder in my site root. Right now this is what it looks like:
include_path = ".:/php/includes:/home/content/p/e/t/petermcdonald/html/scripts/library.php"
but that seems to be gibberish to me and I have no confidence it's the correct format to do the job it's supposed to helping make the ZF connection. Ideally I could simplify this all tremendously by a simple tweak to php.ini or something else to connect to the ZF on the GoDaddy remote server. That's not working either, so as an alternative I also followed instructions in the Powers book to upload the ZF into a library folder. The instructions in the book are to add the ZF library folder to the include_path like this:
include_path = ".:/php/includes:/home/mysite/private/library"
But I can't decipher what that means in real terms for adjusting the line for my site.
Peter
Copy link to clipboard
Copied
conmolbry wrote:
Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 5Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 5
The library.php file looks like this:
<?php
// Adjust the path to match the location of the library folder on your system
//$library = 'http:/www.conmolbry.com/ZendFramework/library';
//set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
The first problem is that the two lines that set the path to the library and and change the include_path are commented out. As a result, they're ignored by the PHP engine.
The second problem is that you're using a URL for the library path instead of a physical path.
The code should look like this:
<?php
$library = '/home/content/p/e/t/petermcdonald/html/ZendFramework/library';
set_include_path(get_include_path() . PATH_SEPARATOR . $library);
require_once('Zend/Loader/Autoloader.php');
[Zend] zend_optimizer.optimization_level=15
zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.3.3
zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3 .3.3
zend_extension=/usr/local/Zend/lib/Optimizer-3.3.3/ZendExtensionManage r.so
zend_extension_ts=/usr/local/Zend/lib/Optimizer_TS-3.3.3/ZendExtension Manager_TS.so,then put the php.ini into the site root.
That's for Zend Optimizer, not the Zend Framework.
According to the GoDaddy help files, you should use php5.ini if your account uses PHP 5 (essential for Zend Framework).
Since GoDaddy allows you to create your own php5.ini file in the site root, you can omit the $library and set_include_path() lines from library.php, and just put this in your php5.ini file in the site root:
include_path = ".:/php/includes:/home/content/p/e/t/petermcdonald/html/ZendFramework/library"
For more information of the PHP include_path, see http://docs.php.net/manual/en/ini.core.php#ini.include-path.
Copy link to clipboard
Copied
Thank you. I had commented out the 2 lines you mention. because the Lesson 13 tutorial said to remove them and this is how I chose to do that until I got things working. I followed your instructions and deleted out these 2 lines entirely in the library.php script as you said. The library.php now looks like this:
<?php
// Adjust the path to match the location of the library folder on your system
require_once('Zend/Loader/Autoloader.php');
try {
Zend_Loader_Autoloader::getInstance();
$write = array('host' => 'wfrma.db.5915058.hostedresource.com',
'username' => 'wfrma',
'password' => 'xxxxxx',
'dbname' => 'wfrma');
$read = array('host' => 'wfrma.db.5915058.hostedresource.com',
'username' => 'wfrmaread',
'password' => 'yyyyyy',
'dbname' => 'wfrma');
$dbWrite = new Zend_Db_Adapter_Pdo_Mysql($write);
$dbRead = new Zend_Db_Adapter_Pdo_Mysql($read);
} catch (Exception $e) {
echo $e->getMessage();
}
It wasn't clear to me if the php5.ini file should include just the line you identified or the whole file with this line in it. I had created the php5.ini from the php.ini file I had while going through your tutorials in the book. I just re-named it to php5.ini and made changes. I tried using the file with all of the information, as well as just with the line you indicated. Neither worked for me. Here are the messages I got which are similar to the ones before regarding the Autoloader:
Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 3
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/php/includes:/home/content/p/e/t/petermcdonald/html/ZendFramework/library') in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 3
One final thing I tried was to add another library to the include_path, as in library/ZendFramework/library, since the ZF is in a library folder per the instructions in the lesson. When I did that, this is what came up at the top of the login webpage:
Zend_Session::start() - /home/content/p/e/t/petermcdonald/html/library/ZendFramework/library/Zend/Session.php(Line:480): Error #2 session_start() [function.session-start]: open(C:\xampp\tmp/sess_hca8igq5mai8423jh35qrvcql1, O_RDWR) failed: No such file or directory (2) Array /home/content/p/e/t/petermcdonald/html/library/ZendFramework/library/Zend/Session.php(Line:490): Error #2 session_write_close() [function.session-write-close]: open(C:\xampp\tmp/sess_hca8igq5mai8423jh35qrvcql1, O_RDWR) failed: No such file or directory (2) Array /home/content/p/e/t/petermcdonald/html/library/ZendFramework/library/Zend/Session.php(Line:490): Error #2 session_write_close() [function.session-write-close]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\xampp\tmp) Array
Have I missed or misinterpreted one or more steps in your instructions?
Peter
Copy link to clipboard
Copied
conmolbry wrote:
Thank you. I had commented out the 2 lines you mention. because the Lesson 13 tutorial said to remove them
If you read pages 468-469 again, you'll see that the instructions say "If you don't have control over php.ini on your remote server, just change the value of $library in scripts/library.php to point to your new library folder."
The rest of that section applies only if you have control over php.ini. If you have no control over php.ini, there's no point in changing the value of $library and then deleting it or commenting it out. By this stage in the book, I would have hoped something like that would be obvious. However, since it seems to have confused you, that section will need to be made more explicit in a future edition.
It wasn't clear to me if the php5.ini file should include just the line you identified or the whole file with this line in it. I had created the php5.ini from the php.ini file I had while going through your tutorials in the book. I just re-named it to php5.ini and made changes. I tried using the file with all of the information, as well as just with the line you indicated. Neither worked for me. Here are the messages I got which are similar to the ones before regarding the Autoloader: Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 3
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/php/includes:/home/content/p/e/t/petermcdonald/html /ZendFramework/library') in /home/content/p/e/t/petermcdonald/html/scripts/library.php on line 3
The ability to use multiple php.ini files on shared hosting is a relatively new feature, of which I have no personal experience, because I use a dedicated server. However, I have done some research, and I believe that you need to use a full php.ini file, rather than just the lines you want to change.
The error messages indicate that the include_path has been correctly reset to point to the ZendFramework/library folder in your site root. The fact that it's not finding the ZF files indicates that your site hierarchy is different. In fact, your most recent attempt indicates that the ZF files were in library/ZendFramework/library.
Zend_Session::start() - /home/content/p/e/t/petermcdonald/html/library/ZendFramework/library/ Zend/Session.php(Line:480): Error #2 session_start() [function.session-start]: open(C:\xampp\tmp/sess_hca8igq5mai8423jh35qrvcql1, O_RDWR) failed: No such file or directory (2) Array /home/content/p/e/t/petermcdonald/html/library/ZendFramework/library/ Zend/Session.php(Line:490): Error #2 session_write_close() [function.session-write-close]: open(C:\xampp\tmp/sess_hca8igq5mai8423jh35qrvcql1, O_RDWR) failed: No such file or directory (2) Array /home/content/p/e/t/petermcdonald/html/library/ZendFramework/library/ Zend/Session.php(Line:490): Error #2 session_write_close() [function.session-write-close]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\xampp\tmp) Array
This error message confirms that the Zend Framework files are being accessed. Why has it gone wrong?
If you read the error messages, you'll see several references to
C:\xampp\tmp/sess_hca8igq5mai8423jh35qrvcql1, O_RDWR
This is because you have copied the php.ini file from XAMPP, which sets the session.save_path directive to C:\xampp\tmp. Just changing this directive in php5.ini to the correct value for GoDaddy might solve this problem, but I have no idea what the correct value would be. It depends on how the server has been configured by GoDaddy. However, even if changing the session.save_path directive were to solve this problem, you're likely to bump into others later, because many other directives in the php5.ini that you're now using are also configured for XAMPP and Windows, not GoDaddy and Linux.
Ask the GoDaddy support desk for the correct version of php5.ini, and then edit it to change the include_path.
If you're setting the include_path in php5.ini, you don't need the two lines in library.php.
Copy link to clipboard
Copied
What about if I simply don't want to deal with GoDaddy and their php.ini file at all? I'm not really wanting to do that at this point anyway, if I don't have to. I have no idea what ZendOptimizer is, but that's what they told me they had when I asked if ZF was available on their server and for me to connect to in my hosted account. Everything fell apart from there. Can I not just use the scenario in your book that I have no control over php.ini on the remote server (p. 468) and instead keep those 2 lines in the library.php file and using the reference that you provided earlier? Would I then need to deal with php.ini's at all?? Sorry this particular section is terribly confusing to me, at least trying to figure it out under my host provider.
Copy link to clipboard
Copied
I'm not sure how I can make this much clearer. The book describes two ways of handling the situation:
It seems that you have the option to change php.ini (or php5.ini in your case). If you don't want to do so, using the first option should work fine.
Having said that, I have no way of knowing what the standard setup on your GoDaddy hosting plan is like. If individual GoDaddy sites each have their own configuration file (php.ini or php5.ini), and you have replaced it with the one from XAMPP, you'll need to ask GoDaddy to restore your configuration settings back to the default values.
On the other hand, if GoDaddy tells you that you don't need php5.ini for a standard PHP configuration (or you are certain that it didn't exist before you created it), you can delete the version you copied from XAMPP.
Zend Optimizer is a utility that enhances the performance of PHP scripts. It's not necessary unless you're building a complex application.
Copy link to clipboard
Copied
Ok I appreciate your patience. I think the lack of clarity is borne of the misunderstanding of the 2 options and the role of the php.ini file AND the advantages and disadvantages of one vs. the other approach. As you said, you can use me as somewhat of a litmus (but only a sample of 1) for the lowest common denominator that your books may include as part of the audience. Your books are the best on this, don't get me wrong. And I am ever grateful for them. Maybe we're both learning something along the journey.
Copy link to clipboard
Copied
David, thank you profusely, both for your expertise and your patience. I think the issue is finally resolved despite myself. In my insecurity, I was making things too difficult for the both of us (as you were probably aware). I deleted the php5.ini file from the site's root directory. I then added the 2 lines back into the library.php file. I did have to add another library to the path as I indicated earlier, e.g. ...library/ZendFramework/library in order for the script to point to the correct location per the book's instructions to create a library folder in the site root to copy the ZF into. I don't know if this procedure is the best way and I think I would have preferred to hook into ZF on GoDaddy's server rather than upload 25mb of ZF files into my site. However, I'm deliriously happy that the site has now been successfully converted from the local testing environment that I've been working in for a long time, to the remote server and the dynamic site appears to be functioning as designed. Well, I'm still trying to resolve the file upload feature mentioned in an earlier thread that has been functioning sporadically in the local testing environment. One hurdle at a time. Many, many thanks for helping me over this one. This forum and you are a great asset to be able to utilize.
Peter
Copy link to clipboard
Copied
I'm glad you got there in the end. I would recommend taking time to review Lesson 3 in order to become more familiar with PHP syntax. I think that a lot of your difficulties stem from your newness to the language. Just following the steps in my book one by one gets the job done, but you need time for everything to sink in.
When I was in Los Angeles at Adobe MAX last month, I met a university lecturer from Kansas (I think), who surprised me by saying she had adopted the book for the university's advanced web course. The book is aimed at intermediate web developers/designers, but it moves at a fairly rapid pace, so it gets to complex subjects at the end.