i am getting the following errors when i am trying to include a file.. i have tried chmod 777 for the directory..checked twice ,the path is correct ..but still the errors persist
the errors are:
Warning: require(../lib/GoogleChart.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/project1/admin/googlechart/examples/line_chart_full.php on line 3
Fatal error: require(): Failed opening required '../lib/GoogleChart.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/project1/admin/googlechart/examples/line_chart_full.php on line 3
What might be wrong is it with the permission cause i have done chmod -R 777 on the directory
You coul try with absolute path starting from documen root (if you have no needs to run the script in command line because $_SERVER array is not provided if the script is launched by a shell)
require($_SERVER['DOCUMENT_ROOT'] . "/lib/GoogleChart.php";
Giving that the lib directory is in the root (www.example.com/lib/GoogleChart.php).
I would suggest require_once instead
Related
I have [root]/includes/helpdesk/pipe.php with this code:
#!/opt/cpanel/ea-php55/root/usr/bin/php
<?php
require_once("pipeprocess.php");
In the same location in pipeprocess.php in first line I include another file still in the same location: helpdesk.php
then in [root]/includes/helpdesk/helpdesk.php in the first line I have:
require_once ("../../config.php");
config.php is in [root], this is why I have twice ../../, helpdesk.php works fine with direct access, but if run pipe.php via pipe command setup in cPanel I get a bounce error that config. php is not found:
PHP Warning: require_once(../../config.php): failed to open stream:
No such file or directory in
/home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on line
21
Warning: require_once(../../config.php): failed to open stream: No
such file or directory in
/home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on line
21 PHP Fatal error: require_once(): Failed opening required
'../../config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
in /home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on
line 21
Fatal error: require_once(): Failed opening required
'../../config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
in /home/[user]/public_html/[root]/includes/helpdesk/helpdesk.php on
line 21
Why I am getting this pipe error as direct access to helpdesk.php works fine? does pipe not accept ../ or ../../ as parth of the path? or is there an EasyApache4 issue? I did several tests and noticed this is because of ../ as part of including path. Does pipe/EasyApache4 have problem with this?
What if you used __DIR__, based on where your currently running script file's folder?
As of PHP 5.3.0, you could use something like this:
require_once (__DIR__ . "/../../config.php");
I'm having problems debugging this php error. '/app/bootstrap.php' exists so not sure why I'm getting this error? Can anyone help? Thanks
[24-Mar-2017 10:42:50 Europe/London] PHP Warning: require_once(/app/bootstrap.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/example.com/index.php on line 2
[24-Mar-2017 10:42:50 Europe/London] PHP Fatal error: require_once(): Failed opening required '/app/bootstrap.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.30/lib/php') in /Applications/MAMP/htdocs/example.com/index.php on line 2
The path /app/bootstrap.php looks like a root path ( and the root isn't your website root, but your Mac root directory).
Change require path to __DIR__ . '/app/bootstrap.php', it means to require a sccript that in /app/bootstrap.php relative to CURRENT directory.
I need help solving , what says to be a permission error in the htdocs folder, because i needed to alter them to even add folders in the first place.
This is my init.php file:
<?php
//Start Session
session_start();
//Include Configuration
require_once('config/config.php');
//Helper Function Files
require_once('helpers/system_helper.php');
require_once('helpers/format_helper.php');
require_once('helpers/db_helper.php');
//Autoload Classes
function __autoload($class_name){
require_once('libraries/'.$class_name . '.php');
}
?>
I try to include it via `
When i run my index.php file i get this error:
Warning: require_once(../../htdocs/PHP-Wizard/helpers/system_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
Fatal error: require_once(): Failed opening required '../../htdocs/PHP-Wizard/helpers/system_helper.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
I tried going one folder up with ../ , but it doesn't work.
I looked around for a similar error to mine, but no luck. They all say No such file or directory in (path).
Could it be that it is the same error, or do i really need to change my permissions, if so, how can i do that?
Edit: When i use include_once('helpers/system_helper.php'); i get this error:
Warning: include_once(helpers/system_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
Warning: include_once(): Failed opening 'helpers/system_helper.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
Warning: include_once(helpers/format_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 10
Warning: include_once(): Failed opening 'helpers/format_helper.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 10
Warning: include_once(helpers/db_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 11
Warning: include_once(): Failed opening 'helpers/db_helper.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 11
The problem was indeed the permissions, i'm guessing because i copied the folder.
I fixed it by chmod 777 on all the files in that folder, and now it works fine.
Thank you for your time attempting to help me.
I tested using relative paths and it works fine.
<?php
require_once '../test.php';
echo ' you';
Where test.php just contains echo "hello"; resulted in the expected "hello you".
I would guess your problem is with file permissions. Can you check what permissions are on your system_helper.php? It should be at least executable by the user php is running as (usually www-data). I could reproduce your error message by doing a chown root test.php and chmod 600 test.php so I would guess something like
chown www-data: system_helper.php
or
chmod g+rwx system_helper.php
should give you permission to run the script.
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
I am on Ubuntu 11.10 and installed apache server to host my local website before i host it from a company.
My website root location is "/home/a1a4a/www/"
I have a php file in /home/a1a4a/www/account/account_info.php"
That i want him to include a file in "/home/a1a4a/www/include/fg_membersite.php"
It's what i did from account_info.php
require_once('./include/fg_membersite.php');
And i got this error
Warning: require_once(./include/fg_membersite.php): failed to open stream: No such file or directory in /home/a1a4a/www/account/account_info.php on line 10 Fatal error: require_once(): Failed opening required './include/fg_membersite.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/a1a4a/www/account/account_info.php on line 10
So what have i done wrong ? How to fix .
I have full permissions ( sudo chown -R www-data ).
Thanks and Happy Holidays :)
Always use the absolute path or you will face errors depending on the calling script.
require_once('./include/fg_membersite.php');
should actually be
require_once(dirname(dirname(__FILE__)).'/include/fg_membersite.php');