My website directory was moved to another server but the database is still the same. Will this cause an issue on Propel? Because I'm getting this error:
Fatal error: require_once(): Failed opening required
'propel/Propel.php'
(include_path='/www/inc:/var/www/www.samplesite.com/classes:.:/usr/share/php:/usr/share/pear')
in /var/www/www.samplesite.com/config.php on line 7
Or is this error caused by something else, not Propel?
Do I perhaps need to execute a rebuild of the Propel installation in order to correct the paths by itself?
You need to set_include_path() just before you call require_once
Related
I want to use Guzzle in my project without using Composer(limitation I can't avoid). I have downloaded their phar file in my project directory PROJECT_ROOT/includes/guzzle.phar
Now in my other files if I use require_once or include or include_once it throws Fatal Error below:
PHP Fatal error:
require(): Failed opening required 'phar://guzzle.phar/autoloader.php (include_path='.:/usr/share/php:PROJECT_ROOT/includes') in PROJECT_ROOT/includes/guzzle.phar on line 3
But when I use
require 'includes/guzzle.phar'
it throws the above error first time the page loads but when I refresh it doesn't throw any error and works ok after that.
Over the past two days, I have looked at various SO questions, tried using include_once, include, require_once and adding PROJECT_ROOT to include path but nothing seems to work.
Any help is appreciated and do let me know if any more info is needed. Thanks
The mentioned PHP Fatal error will throw only if the file path is in correct, you can also find Warnings mentioning the file path is incorrect just before the Fatal error.
PHP Fatal error:
require(): Failed opening required 'phar://guzzle.phar/autoloader.php (include_path='.:/usr/share/php:PROJECT_ROOT/includes') in PROJECT_ROOT/includes/guzzle.phar on line
On each Error/Warning/Notice PHP include information about the error cause to help the developer to track the issue.
Failed opening required 'phar://guzzle.phar/autoloader.php
From the above line/code you can find that the guzzle.phar file path is incorrect, try to use an absolute path insted of relative one.
require_once $_SERVER['DOCUMENT_ROOT'].""."includes/guzzle.phar"
I'm getting this error when my site is online
[host www.sitename.com] Backend fatal error: PHP Fatal error: require_once() [function.require]: Failed opening required 'admin/config/connection.php' (include_path='.:/opt/cpanel/ea-php53/root/usr/share/pear:/opt/cpanel/ea-php53/root/usr/share/php') in /home/mistrybu/public_html/index.php on line 373\n
The site works well in localhost but when its put online , the dynamic part is not showing.
I changed the php version from php7 to php5 in cpanel. Now the front end is working but the backend is not.
Can someone help me solve this error?
PHP version
Definitely do not go back to PHP5. Keep it to 7. If that means rewriting some of the existing code, so be it, it will make your site more secure and more future proof.
Error Message
Your require_once() method cannot find or access a particular file. This is most probably because:
File missing
The file (connection.php) doesn't exist in the given location (admin/config). Now keep in mind that as the location doesn't start with a /, it's going to be relative to where the require_once() method is being run from.
Since you're running require_once() from:
home/mistrybu/public_html/
it's going to look for the file here:
/home/mistrybu/public_html/admin/config/.
Does that location exist? Does the connection.php reside in the folder?
Folder mismatch
Try adding the following prefix to your path, and see if that makes a difference:
require_once $_SERVER['DOCUMENT_ROOT'].'/admin/config/connection.php';
File errors
Maybe the file exists, but for some reason, gives an error. Try running the following from your command line and see if you get any errors:
php -f admin/config/connection.php
When I moved MediaWiki from Localhost to the server I started getting the below error. I am using the latest version and tried to use php 5.3, 5.4 and 5.5 but error exists for all version of php. I know this might not be php version related but just cross checked.
Warning:
require_once(/home/meuser/public_html/site_dir\extensions\Cite\Cite.php):
failed to open stream: No such file or directory in
/home/meuser/public_html/site_dir/LocalSettings.php on line 132
Fatal error: require_once(): Failed opening required '/home/meuser/public_html/site_dir\extensions\Cite\Cite.php'
(include_path='.:/opt/php54/lib/php') in
/home/meuser/public_html/site_dir/LocalSettings.php on line 132
When I commented Cite extension (to disable the extension) to cross check, it gives the same error for the next extension. So I believe there is something wrong in moving server?
I have just uploaded all files to the server and changed database and site url settings in Localsettings.php and imported database.
Is there any extra step required?
There's an issue with the directory separators in your paths. Notice how they're all forward slashes until you reach site_dir. Fix these and it should work perfectly. Based on this code the paths you need to change are in LocalSettings.php
i think this will help you
Syntax:
require_once($_SERVER['DOCUMENT_ROOT']./your file location with only '/' slash);
ie.,
require_once($_SERVER['DOCUMENT_ROOT']./site_dir/extensions/Cite/Cite.php);
I keep getting these error messages in my error log:
PHP Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'PDO Connection Error: SQLSTATE[00000] [1135] Can't create a new thread (errno 12); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug
PHP Fatal error: Class 'Doctrine_Connection_Exception' not found in /var/www/vhosts/domain.com/httpdocs/application/plugins/doctrine/lib/Doctrine/Connection.php on line 474
PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/var/www/vhosts/domain.com/httpdocs/system/codeigniter/CodeIgniter.php' (include_path='.:') in /var/www/vhosts/domain.com/httpdocs/index.php on line 140
PHP Warning: require_once(/var/www/vhosts/domain.com/httpdocs/system/codeigniter/CodeIgniter.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: Too many open files in system in /var/www/vhosts/domain.com/httpdocs/index.php on line 140, referer: ''
I do not know if these issues are related to each other or not. Just thought I'd mention it.
Everytime one of this error occurs, the corresponding page on my site does not load. Please help me decode the issue.
Some more information - The site is hosted on Media temple's DV plan.
Thanks in advance,
Kamalesh
For the first error: Your SQL server is out of memory. This isn't fixable by PHP, you need to (let someone) configure your SQL server so it has more available memory -OR- profile and optimize your queries (if possible).
The second error: Some PHP file can't find the file that contains the Doctrine_Connection_Exception, from the first error I can see that it does exists and sometimes can be found, I'm guessing it's a problem with your include path,
Thanks for your suggestions. I think I have figured out the problem.
We switched on 'keep_alive' in httpd.conf recently. The errors have stopped propping up on switching it off.
Here is the first error:
Warning: require(/hb/includes/constants.php) [function.require]: failed to open stream: No such file or directory in C:\wamp2\www\hb\includes\connection.php on line 2
And the second error that immediately follows:
Fatal error: require() [function.require]: Failed opening required '/hb/includes/constants.php' (include_path='.;C:\php\pear') in C:\wamp2\www\hb\includes\connection.php on line 2
Here is the line that it doesn't like:
require("/hb/includes/constants.php");
I did install a new version of WAMP, but I know the directories/files are fine and the code worked previously and on another server. It seems like none of my require()'s are working anymore. I tried looking around and some suggested to others that they edit their php.ini, but I don't know what directory I would point to - if you can't tell I'm pretty noobish regarding all things server related.
Any help is appreciated.
First of all, are your really -- really ! -- sure that the file /hb/includes/constants.php, that your are trying to include, exists ?
Considering that the path you requested begins with a /, it looks like you're using an absolute path... that looks like an UNIX path, but you are on a Windows server...
If it exists, and PHP still cannot include it, check :
that it is readable by your webserver (including the directories) -- I'm thinking about UNIX permissions
that there is no open_basedir restriction that would prevent PHP from accessing those files.
BTW, having a warning and a fatal error is the behavior that's to be expected when using require : the warning is normal (it comes from include) ; and the fatal error is the difference between include and require.