PHP/SQL - failed to open stream: No such file or directory

Krug

Set up a (Wordpress) local website using WAMP. For security reasons, in phpmyadmin, created a new user and deleted user root. New user was supposed to have global privileges, but had none.

Used the following post to recreate user root deleted-mysql-root-user-using-phpmyadmin-how-to-restore. It worked, partially (i.e. recreated root user, that has Global Privileges, yet still can't create new databases, as it says "Create database: Documentation; No Privileges"). But now site is broken. I get the following error when going to localhost/mywebsite :

    Warning: require(C:\wamp64\www\wordpress1\wordpress/wp-includes/session.php): failed to open stream: No such file or directory in C:\wamp64\www\wordpress1\wordpress\wp-settings.php on line 150
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0000  236160  {main}( )   ...\index.php:0
    2   0.0025  239304  require( 'C:\wamp64\www\wordpress1\wordpress\wp-blog-header.php' )  ...\index.php:17
    3   0.0025  259856  require_once( 'C:\wamp64\www\wordpress1\wordpress\wp-load.php' )    ...\wp-blog-header.php:13
    4   0.0050  271784  require_once( 'C:\wamp64\www\wordpress1\wordpress\wp-config.php' )  ...\wp-load.php:39
    5   0.0075  403592  require_once( 'C:\wamp64\www\wordpress1\wordpress\wp-settings.php' )    ...\wp-config.php:92

    Fatal error: require(): Failed opening required 'C:\wamp64\www\wordpress1\wordpress/wp-includes/session.php' (include_path='.;C:\php\pear') in C:\wamp64\www\wordpress1\wordpress\wp-settings.php on line 150
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0000  236160  {main}( )   ...\index.php:0
    2   0.0025  239304  require( 'C:\wamp64\www\wordpress1\wordpress\wp-blog-header.php' )  ...\index.php:17
    3   0.0025  259856  require_once( 'C:\wamp64\www\wordpress1\wordpress\wp-load.php' )    ...\wp-blog-header.php:13
    4   0.0050  271784  require_once( 'C:\wamp64\www\wordpress1\wordpress\wp-config.php' )  ...\wp-load.php:39
    5   0.0075  403592  require_once( 'C:\wamp64\www\wordpress1\wordpress\wp-settings.php' )    ...\wp-config.php:92

All files exist. I presume problem is server does not have access to the files or database. The following question/answer may have the answer to my problem: php-failed-to-open-stream-no-such-file-or-directory/36577021. But I do not understand the instructions provided on point 4 of the accepted answer - see below:

/*To check under what user the server is running you can use posix_getpwuid :*/
$user = posix_getpwuid(posix_geteuid());
var_dump($user);

How do I do that?

-- To find out the permissions on the file, type the following command in the terminal:
ls -l <C:/wamp64/www/wordpress1/wordpress>

Did not work for me. Typing that in the terminal results in an arrow after pressing enter.

I have spent 12 full hours on this and I am at wits end. Would greatly appreciate any help. Thank you.

Krug

Solved my issue by doing the following:

  1. save wp-site folder / delete wamp / reintall wamp
  2. place wp-site folder inside wamp
  3. create SQL database in phpmyadmin / import database backup

    => exact same error => problem is inside wp-site folder

  4. replaced core wordpress files/folders with clean install, keeping prior wp-content folder and wp-config.php

PRESTO. Sometimes better to not understand the problem, and start from scratch.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

failed to open stream: No such file or directory

Failed to open stream: No such file or directory

failed to open stream: No such file or directory Codeignter

failed to open stream: No such file or directory (Laravel)

PHP - Failed to open stream : No such file or directory

failed to open stream: No such file or directory issue

failed to open stream: No such file or directory on Homestead environment

PHP - failed to open stream: No such file or directory in

PHP Warning failed to open stream: No such file or directory

fopen: failed to open stream: No such file or directory - but file/directory exists

file_get_contents(): failed to open stream: No such file or directory

file_get_content: failed to open stream: No such file or directory

move_uploaded_file(...): failed to open stream: No such file or directory

File upload on s3 : failed to open stream: No such file or directory

file exists but fopen "failed to open stream no such file or directory"

File exists but PHP throwing "failed to open stream: no such file or directory"

File exists but getting warning of failed to open stream: No such file or directory

Failed to open stream. No such file or directory only in __destruct()

Laravel classloader.php error failed to open stream: No such file or directory

PHP Warning: require_once: failed to open stream: No such file or directory in

Zend include_once(myphpfile): failed to open stream: No such file or directory

include(MultiModelForm.php): failed to open stream: No such file or directory

Failed to open stream: No such file or directory in...? PHP Specific

yii PDO.php error: failed to open stream: No such file or directory

Failed to open stream: No such file or directory, when using __DIR__

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Magento backend extension failed to open stream: No such file or directory

php artisan migrate:reset failed to open stream: No such file or directory

app/bootstrap.php.cache : failed to open stream: No such file or directory