user1283791
user1283791

Reputation: 279

php require_once "FILENAME" causing Failed opening required ''

In .php I have this:

Line 64  require_once 'Zend/View/Stream.php'

in apache error log I see: [error] [client 127.0.0.1] PHP Fatal error: require_once(): Failed opening required '' (include_path='.........

I've been googleing and debugging four hours.. Maybe this sounds familiar to someone.. I dont understand how code line

require_once 'Zend/View/Stream.php'

cause

Failed opening required ''

Upvotes: 4

Views: 498

Answers (1)

Th. Ma.
Th. Ma.

Reputation: 9464

EDIT According to https://bugs.php.net/bug.php?id=62398, there was a bug in some earlier versions of APC extension with PHP 5.4 which replaced the file passed to require with an empty string.

Thanks to @conceptdeluxe, who figured this out when using PHP 5.4.30 with APC 3.1.13. A possible resolution has be confirmed to be about enabling APC via configuration directive apc.stat=1 (in php.ini) or upgrading PHP and extensions.

Otherwise

You might want to update the include_path configuration option by following instructions available at http://php.net/manual/fr/function.set-include-path.php

Basically, the interpreter needs to be told where to look for the Zend classes.

Let us assume, Zend library is available from /var/www/my_project/vendor/Zend then we could make the next call before using Zend Stream:

set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/my_project/vendor');

Another solution would consist in altering the PHP configuration file by updating the include_path value as follow:

# assuming vim is available as text editor 
# and PHP configuration file would be available for editing
vim /etc/php.ini

# append /var/www/my_project/vendor to the value of entry
include_path='.:/var/www/my_project/vendor'

Upvotes: 1

Related Questions