require(): Failed opening required php file - php

Recently, I formated my whole computer, and installed Windows 7 64-bit. Before doing that I saved all of my files on an external hard drive. One of the things I backed up was a PHP script which uses AWS DynamoDB Services.
Before I formated my computer, everything went perfect. After I formated it, I installed on it XAMPP, Visual Studio Code, and PHP 7.1.1 through Microsoft WebPI.
Currently when I'm trying to run my PHP script I get this error on my screen:
Warning: require(/zip/aws/aws-autoloader.php): failed to open stream: No such file or directory in D:\Users\Lenovo\xampp\htdocs\public_html\file.php on line 7
Fatal error: require(): Failed opening required '/zip/aws/aws-autoloader.php'(include_path='D:\Users\Lenovo\xampp\php\PEAR') in D:\Users\Lenovo\xampp\public_html\file.php on line 7
I'm calling the autoloader this way:
require '/zip/aws/aws-autoloader.php';
I'm trying to understand if I forgot to install another thing, or if it's something related to the system (I had Windows 10 before)...
Could you please help me figure it out? I'm pretty new to this topic of PHP...

You should specify the entire path, like this: require __DIR__ . '/zip/aws/aws-autoloader.php';

Related

Use php require for local directory

I have recently been trying to add PHPMailer script to my site, following the accepted answer from here:
Send attachments with PHP Mail()?
I have never used a require statment before so I assume I must be doing it wrong, currently testing on my local host version of the site. I have downloaded the entire zip of git (unzipped it) and moved it to the dir my scripts are in.
In my script I added the following line:
require_once(__DIR__.'/PHPMailer-master/class.phpmailer.php');
Which to my understanding was all I needed to do to use it. However I get this error:
Warning:
require_once(C:\xampp\htdocs\Website\PHPMailer-master\class.phpmailer.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\Website\include\mailer.php on line 10
Fatal error: require_once(): Failed opening required
'C:\xampp\htdocs\Website\PHPMailer-master\class.phpmailer.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\Website\include\mailer.php on line 10
Any ideas what is causing this error? Am running PHP 5.6.21 if this is relevant.
Try to use the full path to the file, using realpath() - http://php.net/realpath, and use dirname(__FILE__) to get your current directory:

Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in ......?

I moved wordpress from one server to other...home page is running fine but when I click to category pages/links it shows these errors
Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/server/public_html/index.php on line 17
Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in /home/server/public_html/index.php on line 17
Fatal error: require() [function.require]: Failed opening required './wp-blog-header.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/server/public_html/index.php on line 17
I searched on google and tried accordingly but not solved. I tried wp-codex tech like http://codex.wordpress.org/Changing_The_Site_URL but also failed. I have the wp-blog-header file in my directory but still not working....any help ...thanx in advance
Change php version for 7. My tech.support make this and problem was done
I had a similar issue and the problem was with the PHP version used which in my case by default was PHP 5.2 and it was throwing the 500 status code error.
When upgrading the PHP version to 5.3 the 500 status code was gone but Wordpress returned this error:
Your server is running PHP version 5.3.29 but WordPress 5.4.2 requires at least 5.6.20.
Note to myself (and everyone else with this error): When moving Wordpress websites between different servers make sure you are running the minimum required PHP version.
Also remember:
Note: If you are in a legacy environment where you only have older PHP or MySQL versions, WordPress also works with PHP 5.6.20+ and MySQL 5.0+, but these versions have reached official End Of Life and as such may expose your site to security vulnerabilities.
According to WP docs the recommended PHP is version 7.3.
Try the default theme and see if you still have the error. If so the theme you are using is causing the error - as in my case. The page that had an error was calling a file in "pages" that was not there. When I changed what is to show on that page to something current - the error went

Warning: require(__DIR__/warp.php) - Switching Site from one server to another

I am switching over a website that was built on Wordpress from one HostGator server to another HostGator server. I have successfully transferred over the files via FTP, and migrated the MySQL database over and have both connected successfully.
I am running into an issue when I view the site in the browser and I receive this following error message:
Warning: require(DIR/warp.php) [function.require]: failed to open stream: No such file or directory in /home/abcworld/public_html/new2/wp-content/themes/yoo_moustache_wp1/index.php on line 10
Warning: require(DIR/warp.php) [function.require]: failed to open stream: No such file or directory in /home/abcworld/public_html/new2/wp-content/themes/yoo_moustache_wp1/index.php on line 10
Fatal error: require() [function.require]: Failed opening required 'DIR/warp.php' (include_path='.:/opt/php52/lib/php') in /home/abcworld/public_html/new2/wp-content/themes/yoo_moustache_wp1/index.php on line 10
When I switch to the themes that comes with Wordpress, the site is displayed with the data that is in the MySQL database, so it seems that the Template is what's causing the error. I am using a Yootheme Template called 'Moustache' and have downloaded the latest version and uploaded it to Wordpress and the error message is still there.
The site I am working on is: http://abcworldwidestone.com/new2/
I am unsure what's causing this and would love some assistance - Any thoughts?
Your server must still be using PHP 5.2 , use 5.3.3 or higher at least.
As per the documentation;
5.3.0 Added DIR and NAMESPACE constants
You are more than likely running PHP version < 5.3.0.

Installing PEAR in Windows Server 2008, PLESK

I'm not one to normally reach out but I've found myself completely stumped by this one.
I have a new server and chose to go with Windows Server 2008 and Plesk. After importing my site, I find that my includes no longer work, coming up with this error message:
require_once(include/online_class.php) [function.require-once]: failed to open stream: Operation not permitted
Fatal error: require_once() [function.require]: Failed opening required 'include/online_class.php
I have disabled open_basedir to make sure that it isn't conflicting but I am still getting this message. I have tried doing a fresh install of PEAR via command line and have made sure include_path points to the correct directory -> C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP5\PEAR
I have switched between both PHP 5.2 and 5.3 - 5.3 will just display a 500 error message without even reaching the php include errors.
Is there something I'm missing here? This is an issue I've never had with linux / cpanel builds and it's leaving a sour taste in my mouth with regards to Windows servers. What can I do to fix this problem?
Any help would be appreciated. Cheers!

FirePHP beginner issues

I am writing a web page that uses some php files. The php isn't working properly and I am trying to debug for things such as printing variables. I am new to php so this is all new territory.
I use firebug for other debugging and css alignment so I thought firephp might be a good way to begin.
I added firePHP into firefox and then following some tutorials I found I added this to my php file:
<?PHP
/* comment here down to line 15 */
require_once('FirePHPCore/FirePHP.class.PHP');
$firephp = FirePHP::getInstance(true);
The result I get when I load my page is:
Warning: require_once(FirePHPCore/FirePHP.class.PHP): failed to open stream: No such file or directory in /var/www/contactform.php on line 15 Fatal error: require_once(): Failed opening required 'FirePHPCore/FirePHP.class.PHP' (include_path='.:/usr/share/php') in /var/www/contactform.php on line 15
It seems like some more setup and library loading is required, but I am not sure what or how?
I am developing on Ubuntu using apache and /var/www/ as my local server.
Description: Ubuntu 11.04
Release: 11.04
Codename: natty
Advice on how to get past this error?
You need to add the "FirePHPCore" folder to the same directory that this code is being run in
require_once('FirePHPCore/FirePHP.class.php');
The file extension (.php) is NOT SUPPOSED TO BE CAPITALIZED.

Categories