Functions with or without paranthesis
Moderator: General Moderators
Functions with or without paranthesis
My problem is a general PHP problem even it's related to Zend Framework.
I am using Zend Framework for a project i am starting now.
I like this framework but i have a problem on one of servers.
Seems that is not recognized this syntax:
require_once 'Zend/Exception.php';
but
require_once('Zend/Exception.php');
works just fine.
On other server with apparently same php.ini config the syntax without paranthesis is working fine... The files are just fine on server, paths are fine on both servers...
Any idea ?
This is the error i am receiving on logs:
[Thu Oct 26 11:13:59 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.req
uire</a>]: Failed opening required 'Zend/Exception.php' (include_path='/usr/local/lib/php') in /usr/home/test/public_html/
Zend/Zend.php on line 25
I am using Zend Framework for a project i am starting now.
I like this framework but i have a problem on one of servers.
Seems that is not recognized this syntax:
require_once 'Zend/Exception.php';
but
require_once('Zend/Exception.php');
works just fine.
On other server with apparently same php.ini config the syntax without paranthesis is working fine... The files are just fine on server, paths are fine on both servers...
Any idea ?
This is the error i am receiving on logs:
[Thu Oct 26 11:13:59 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.req
uire</a>]: Failed opening required 'Zend/Exception.php' (include_path='/usr/local/lib/php') in /usr/home/test/public_html/
Zend/Zend.php on line 25
It does recognize the require_once (it even says so). But there is no such file. I really doubt that only require_once('Zend/Exception.php') can fix that.[Thu Oct 26 11:13:59 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.req
uire</a>]: Failed opening required 'Zend/Exception.php' (include_path='/usr/local/lib/php') in /usr/home/test/public_html/
Zend/Zend.php on line 25
Hi,
Thanks for your reply.
I made a simple test with two files of my own and indeed, is working with or without parenthesis.... So, this is not the probleme...
Then, let's tell u what i did for Zend Framework case.
For any require_once without parenthesis, php jumped over this statement - i mean didn't reported any new error, just jumped to next... So i though error is fixed with this simple replace... Problem is i can't replace for all require_once, a lot of code...
So, i am stuck...
This are the errors i get if using Framework without any changes:
[Fri Oct 27 09:52:30 2006] [error] [client 80.80.80.80] PHP Warning: require_once(Zend.php) [<a href='function.require-once'>func
tion.require-once</a>]: failed to open stream: No such file or directory in /usr/home/test/public_html/Zend/Db.php on line
25
[Fri Oct 27 09:52:30 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.requ
ire</a>]: Failed opening required 'Zend.php' (include_path='/usr/local/lib/php') in /usr/home/test/public_html/Zend/Db.php
on line 25
Thanks for your reply.
I made a simple test with two files of my own and indeed, is working with or without parenthesis.... So, this is not the probleme...
Then, let's tell u what i did for Zend Framework case.
For any require_once without parenthesis, php jumped over this statement - i mean didn't reported any new error, just jumped to next... So i though error is fixed with this simple replace... Problem is i can't replace for all require_once, a lot of code...
So, i am stuck...
This are the errors i get if using Framework without any changes:
[Fri Oct 27 09:52:30 2006] [error] [client 80.80.80.80] PHP Warning: require_once(Zend.php) [<a href='function.require-once'>func
tion.require-once</a>]: failed to open stream: No such file or directory in /usr/home/test/public_html/Zend/Db.php on line
25
[Fri Oct 27 09:52:30 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.requ
ire</a>]: Failed opening required 'Zend.php' (include_path='/usr/local/lib/php') in /usr/home/test/public_html/Zend/Db.php
on line 25
What doesREADME.txt wrote:No special installation is required, however the Framework classes
expect that the /library directory is in your include_path.
Code: Select all
<?php echo ini_get('include_path'); ?>Ok, i used at the beginning of code:
ini_set("include_path", "/usr/local/lib/php; /usr/home/test/public_html; /usr/home/test/public_html/Zend");
But still got same problems:
[Fri Oct 27 10:30:18 2006] [error] [client 80.80.80.80] PHP Warning: require_once(Zend.php) [<a href='function.require-once'>func
tion.require-once</a>]: failed to open stream: No such file or directory in /usr/home/test/public_html/Zend/Db.php on line
25
[Fri Oct 27 10:30:18 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.requ
ire</a>]: Failed opening required 'Zend.php' (include_path='/usr/local/lib/php; /usr/home/test/public_html; /usr/home/test/public_html/Zend') in /usr/home/test/public_html/Zend/Db.php on line 25
ini_set("include_path", "/usr/local/lib/php; /usr/home/test/public_html; /usr/home/test/public_html/Zend");
But still got same problems:
[Fri Oct 27 10:30:18 2006] [error] [client 80.80.80.80] PHP Warning: require_once(Zend.php) [<a href='function.require-once'>func
tion.require-once</a>]: failed to open stream: No such file or directory in /usr/home/test/public_html/Zend/Db.php on line
25
[Fri Oct 27 10:30:18 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.requ
ire</a>]: Failed opening required 'Zend.php' (include_path='/usr/local/lib/php; /usr/home/test/public_html; /usr/home/test/public_html/Zend') in /usr/home/test/public_html/Zend/Db.php on line 25
And I wouldn't add spaces even though it's more readable this way.http://de2.php.net/manual/en/ini.core.php#ini.include-path wrote:include_path string
Specifies a list of directories where the require(), include() and fopen_with_path() functions look for files. The format is like the system's PATH environment variable: a list of directories separated with a colon in Unix or semicolon in Windows.
Code: Select all
ini_set('include_path', ini_get('include_path') . ':/usr/home/test/public_html/Zend');Re: Functions with or without paranthesis
<off-topic>
</off-topic>
Should we consider the actual error message as a bug in PHP? require is not a function but a language construct.[Thu Oct 26 11:13:59 2006] [error] [client 80.80.80.80] PHP Fatal error: require_once() [<a href='function.require'>function.req
uire</a>]
</off-topic>
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Are you talking in terms of the displayed text? The functionality for require()/require_once() is correct, according to the docs, in that require()/require_once() produces a fatal error on failure, instead a warning like include()/include_once().
As for whether it is a function or not, there is no argument there. The manual clearly states it is not a function. Unfortunately, the manual lists it in the function index. Go figure.
As for whether it is a function or not, there is no argument there. The manual clearly states it is not a function. Unfortunately, the manual lists it in the function index. Go figure.