Cannot require Zend/Config/Ini when Zend is in the include path? - php

When I try this:
require_once 'Zend/Config/Ini.php';
I am getting this error in my Zend Framework application:
Warning: require_once(Zend/Config/Ini.php) [function.require-once]: failed to open stream: No such file or directory in /path/to/functions.php on line 408
When I print out my include path, it is:
string(101) "/path/to/www/app/modules/:/path/to/www/lib/:.:/usr/local/share/pear"
I have ZF library in the /path/to/www/lib/ folder, so wtf?

This solved the problem:
chmod -R 755 /path/to/www/lib
Blimey!

Related

Project running on local server (WAMP) but on live server Error: failed to open stream: No such file or directory

I know, that's stupid, but I can't solve the problem with my project.
I wrote project on WAMP firstly and all works.
After, I try to migrate on live server, and find a problem - server don't require my files.
Project structure is:
application
core
Controller.php
Model.php
View.php
Route.php
models
views
controllers
included
config.php
app.php
index.php
when I try to run it, server return error:
Warning: require_once(core/model.php): failed to open stream: No such
file or directory in /home/u224052355/public_html/application/app.php
on line 4
This is the app.php code:
session_start();
require_once 'config.php';
require_once 'core/model.php';
require_once 'core/view.php';
require_once 'core/controller.php';
require_once 'core/route.php';
spl_autoload_register(function($class_name){
include 'included/' . $class_name . '.php';
});
Route::start();
When I try solve this by adding __DIR__ to require_once I gave this message:
Warning:
require_once(/home/u224052355/public_html/application/core/model.php):
failed to open stream: No such file or directory in
/home/u224052355/public_html/application/app.php on line 4
Fatal error: require_once(): Failed opening required
'/home/u224052355/public_html/application/core/model.php'
(include_path='.:/opt/php-5.5/pear') in
/home/u224052355/public_html/application/app.php on line 4
Using the $_SERVER['DOCUMENT_ROOT'] and etc. - same result.
How can I solve this problem?

Failed to open stream: No such file or directory in...? PHP Specific

Getting this warning when trying to run my local PHP project (index.php):
Warning: require_once(/Controller/BulletinController.php): failed to open stream: No such file or directory in /Library/WebServer/Documents/WEBB_SERVER/6.2.1x/index.php on line 2
Fatal error: require_once(): Failed opening required '/Controller/BulletinController.php' (include_path='.:') in /Library/WebServer/Documents/WEBB_SERVER/6.2.1x/index.php on line 2
No such file or directory? This is my first 6 rows in index.php:
<?php
require_once ("/Controller/BulletinController.php");
require_once ("/General/MasterPage.php");
require_once ("./General/dbConnection.php");
session_start();
I've tried giving BulletinController.php 777 rights (just developing locally), but no luck.
This is what my structure looks like, so everything is in place:
Thankful for any advice you may have.
require_once ("/Controller/BulletinController.php");
must be
require_once ("Controller/BulletinController.php");
I think you need the whole path:
require_once dirname(__FILE__) . "/Controller/BulletinController.php";

restFul API : failed to open stream: No such file or directory

I'm working on a restful API in php.
All is working on localhost, but when I try to put it on my server, I have these errors :
Warning: include_once(/path/to/api/simpletodo_api/Models/TodoItem.php) [function.include-once]: failed to open stream: No such file or directory in /homez.338/login/www/path/to/api/simpletodo_api/index.php on line 6
Warning: include_once() [function.include]: Failed opening '/path/to/api/simpletodo_api/Models/TodoItem.php' for inclusion (include_path='.:/usr/local/lib/php') in /homez.338/login/www/path/to/api/simpletodo_api/index.php on line 6
Here my include :
include_once 'Models/TodoItem.php';
index.php and the "Models" folder are in the same folder (in local and on my server).
I'm pretty sure it is a path error, but I can't find the right one.
Have you an idea of the path ?
If your server is Linux-based and your localhost is on Windows, you may be running into file naming errors. File paths in Linux are case-sensitive. Just to be sure prepend the __DIR__ constant to your PHP path like so: include_once __DIR__ . 'Models/TodoItem.php';

require_once() Permisson Denied even after chmod 777

I do Dropbox-API
it needs to access the Dropbox-SDK..
Here is the error shown in browser.
Warning: require_once(dropbox-sdk/Dropbox/autoload.php): failed to open stream: Permission denied in /home/albert/public_html/test/search.php on line 11
Fatal error: require_once(): Failed opening required 'dropbox-sdk/Dropbox/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/albert/public_html/test/search.php on line 11
I have been researching about it and try to chmod all the files, also chown all.. but it still show the same error..
Can anyone help? Thx
Check your include path for it may be that you have to change it or include/require the autoload file using its full path.
Is dropbox-sdk/Dropbox/autoload.php under . or /usr/share/php or /usr/share/pear, if not, that is your problem - your include path is incorrect, or your installation path for Dropbox was placed in the wrong place

Zend - error in index.php - not opening Zend/Application.php

I have a project written in PHP, in zend framework. But when i go on page: localhost/Project/public, i get an error:
Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /var/www/Project/public/index.php on line 18 Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/var/www/Project/library:.:/usr/share/php:/usr/share/pear') in /var/www/Project/public/index.php on line 18
The line 18 in file index.php is following:
require_once 'Zend/Application.php';
I have set include_path in php.ini:
include_path = ".:/usr/share/php:/usr/local/ZendFramework/library"
Zf project is successfully creating by commands from console, so i think that Zend is well configured (anyway in php.ini).
Help me! What I'm doing wrong?
You can see the include path it's using in the error, and it doesn't include /usr/local/ZendFramework/library. Typically index.php overrides the include path to point it at the project's library folder. So either you want a copy of ZF in the library folder, or if you prefer to keep ZF in /usr/local/ you want to edit this include path to point at /usr/local/ZendFramework/library as well.

Categories