0

I am new to ZEnd, any help is greatly appreciated

I had various contractors work on my site, and things got a messy, with multiple copies of the same folders in different locations. Now I am going in and trying to clean things up. FUN!!! One of the problem I am having is that the require_once statements in Zend are not finding the files they are looking for. I am having to go in and change the paths as follows. Assume that this is the code found in Zend/Gdata/App/FeedEntryParent.php

Not Working (Can't Find File):

require_once 'Zend/Gdata/App/Extension/Updated.php';

Seems to Work Fine:

require_once '/home/paul13/paul13.com/includes/library/Zend/Gdata/App/Extension/Updated.php';

The problem is that most of the require_once statements are writting like the first one. short of going in and manually editing all of them, is there a way to tell the require statements to look in the indicated directory? '/home/paul13/paul13.com/includes/library/' using php.ini? I tried entering

include_path=".:/home/paulthetutor/paulthetutors.com/includes/library"

in php.ini, but that does not seem to solve the problem.

  • Got it. I will go back and accept answers that were helpful. Sorry, didn't realize that was part of it. – Paul the Tutor Oct 10 '12 at 07:36
  • A Question: Does your site use Zend Framework as a MCV application or did your contractors just use bits a pieces? Also What version? – RockyFord Oct 10 '12 at 07:40
  • @RockyFord I believe this is the version 23775 2011-03-01 17:25:24Z ralph – Paul the Tutor Oct 10 '12 at 07:49
  • @MatteoTassinari went back and accepted the answers that answered my previous questions. I looked in my php.ini files and didn't find anything about 'include_path'. I had 3 php.ini files in different folders. Hope that isn't a problem. – Paul the Tutor Oct 10 '12 at 07:54
  • are you trying work on this site remotely or do you have a working local Development Environment? – RockyFord Oct 10 '12 at 08:13

2 Answers2

1

The title of your question seems to have little to do with the content you've posted.

I had various contractors work on my site...are not finding the files

You've paid contractors to deliver code which doesn't work?

The problem is obviously that the path in the first

No - the problem is that your include paths are not set up correctly. If you're using an include path as a mechanism to avoid typing lots of stuff then you're doing it wrong. Your include path should not include entries pointing inside a directory tree maintained by someone else. Nor should you be changing this structure without a very specific and valid objective.

As a temporary workaround until you fix the include/require statements to what they should have been in the first place, then change your include path - either in php.ini, in httpd.conf, in .htaccess, via an auto-prepend or at the top of every script.

(BTW you're confusing folders with directories)

symcbean
  • 47,736
  • 6
  • 59
  • 94
  • You are right about the title. I figured out that they are and that I need to get the include path corrected, but didn't update the title. I am now trying to figure out how to get the right path specified in php.ini With regards to the contractors, the code worked when they delivered it, but my site was a mess with different versions of the same folders and files in different places. I am trying to clean things up and learn a bit about php.ini, include paths, Zend and other things in the process – Paul the Tutor Oct 10 '12 at 09:24
0

The folder you mentioned in the question is part of the Zend library. You can check if you have a library folder inside your Zend Framework project and whether it contains the file

'Zend/Gdata/App/Extension/Updated.php'

To include the entire ZF library, use the following code either in your public/index.php or in your Bootstrap.php file.

 // Define path to application directory
 defined('APPLICATION_PATH')
      || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

 // Define application environment
   defined('APPLICATION_ENV')
      || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

  // Ensure library/ is on include_path
 set_include_path(implode(PATH_SEPARATOR, array(
     realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
   )));

And yes, selectively remove the require statements one by one and locally copied versions of library files (after making sure that they do not have updated codes, ofcourse).

You might want to check the default Zend Framework application structure here to compare the folder structures.

janenz00
  • 3,315
  • 5
  • 28
  • 37
  • The ZF library itself is littered with `include` and `require` statements. Be careful changing them. – RockyFord Oct 10 '12 at 07:40
  • Assuming no one has made any modifications other than these require_once statements, would it make sense just to get a new version of it? I could always save the old version and just put it back if need be. If so, where might I get one? – Paul the Tutor Oct 10 '12 at 07:48
  • @janenz00 - Sorry if this sounds daft, but do I copy this code directly, or do I have to change some of the words to my own folder names? Also, I seem to have 2 bootstrap.php files, one in /Applications/Bootstrap, and one in /Applications/Bootstrap – Paul the Tutor Oct 10 '12 at 08:04
  • This code _should_ already exist in the file `application/public/index.php` or something very similar. You may have multiple bootstrap.php files, one for the application and one for each additional module. Replacing the installed Zend framework with a clean version may aid in troubleshooting, carefully backup the old. – RockyFord Oct 10 '12 at 08:08
  • looking in Zend/Applications I don't even see a public folder. Sounds like a bad sign, no? – Paul the Tutor Oct 10 '12 at 08:19
  • @ptt - As RockyFord mentioned, usually this code is there in the application/public/index.php. If it is not there (if your developers messed it up) you can add it as such. No change required. – janenz00 Oct 10 '12 at 14:20