问题
I am trying to get make my setup for using Laravel and I am getting this error when I am trying to access MySQL from XAMPP Control Panel.
Warning: require_once(libraries/common.inc.php): failed to open stream: No such file or directory in C:\xampp\phpMyAdmin\index.php on line 20
Fatal error: require_once(): Failed opening required 'libraries/common.inc.php' (include_path='C:\wamp\php\PEAR') in C:\xampp\phpMyAdmin\index.php on line 20
I have found somequestions that had a similar problem, but cannot figure out how to solve this problem, because I haven`t found a detailed answear that could solve my error.
回答1:
The script index.php
located in C:\xampp\phpMyAdmin\
is trying to load file on relative path libraries/common.inc.php
, ie on location C:\xampp\phpMyAdmin\libraries
.
The require_once
has the feature that when the file is not found, then the PHP is interrupted with PHP Fatal error
, more on PHP Manual: require_once
Make sure the subdirectory libraries
is available and readable for the webserver/apache and the file common.inc.php exists.
Note: it is always better to put strings into quotation marks '
or "
.
Note: make sure to use correct directories separator \
or /
based on your operating system.
Here I guess correct would be require_once('libraries\common.inc.php')
回答2:
Simply use syntax require_once('libraries\common.inc.php')
without dash will be considered as a error because according to function it accept path which is string only not other. here without dash in your line will not be interpreted by PHP due to it neither taken as variable nor Path, hence results FATAL only..
回答3:
You need to logout from phpMyAdmin. Because this issue is related to your session.
Once the session is empty empty then it will work fine. Same thing happens to me and it resolved after logout.
来源:https://stackoverflow.com/questions/47779515/fatal-error-php-xampp