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');
Related
I am new to laravel and I run my website on localhost. It runs correctly but when I upload it on cpanel, it raises these errors :
Warning:
require(/home/didfilei/public_html/app/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or directory in
/home/didfilei/public_html/app/vendor/composer/autoload_real.php on
line 66
Warning:
require(/home/didfilei/public_html/app/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or directory in
/home/didfilei/public_html/app/vendor/composer/autoload_real.php on
line 66
Fatal error: require(): Failed opening required
'/home/didfilei/public_html/app/vendor/composer/../symfony/polyfill-mbstring/bootstrap.php'
(include_path='.:/opt/cpanel/ea-php71/root/usr/share/pear') in
/home/didfilei/public_html/app/vendor/composer/autoload_real.php on
line 66
I solved it. I realized that after extracting the zip file with cpanel, some folders were deleted (eg '/ symfony'), so I got more space from the hosts, then my project extract correctly
Since you do not have access to SSH, you should upload the vendor files along with the rest of your project.
Be careful that if your dev machine is windows, you might face some issues with paths and case sensitivity.
You also need to check how php is executed in your host. You might have to fiddle around with file ownership and access rights.
Especially if suphp is used, your user must be the owner of everything in your folder, all files must be set to 644 and all folders to 755
SSH into your server and run composer update in the root of your project. This will pull in the required vendor files that you are missing.
Problem:
I'm trying to open headerr.php via require_once on a XAMPP localhost server. I'm calling this function through index.php but I keep on receiving the following error message
Errors:
Warning: require_once(/Applications/XAMPP/xamppfiles/htdocs/Baseline/headerr.php): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/Baseline/index.php on line 2
Fatal error: require_once(): Failed opening required 'headerr.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/Baseline/index.php on line 2
Attempted Solutions:
-I've tried setting the permissions to Read & Write for everyone on the (/Applications/XAMPP) Folder but that hasn't fixed the permissions issue.
-I've also tried using require_once dirname(FILE) . '/headerr.php'; but that didn't work either..
In Conclusion:
I suspect that I may have to edit the php.ini file but I have no clue what to do..
I appreciate any advice or insight, thanks!
Try this command:
chmod -R 775 yourWebFolder
I have recently taken backup for my website and wanted to open with xampp on local host but it is showing following errors:
Warning: require_once(/home/content/28/11459128/html/system/startup.php): failed to open
stream: No such file or directory in C:\xampp\htdocs\myfolder\index.php on line 26
Fatal error: require_once(): Failed opening required
'/home/content/28/11459128/html/system/startup.php' (include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\myfolder\index.php on line 26
Can any one help me with this issue.
Thanks,
GC
You need to change all the PATH in your project according to your local machine, or there must a variable in your config file i.e Path to project for local environment is C:/xampp/htdocs and for production server it must be /home/content/whatever. If it is not present you better create one.
I am pretty sure path won't start with / on Windows(local machine).
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 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