Skip to main content

[solved] require_once(), include_once() failed to open stream: No such file or directory

Pred skoraj letom sem opazil, da ima WordPress (ta blog) težave z določenimi temami in dodatki. Takrat se nisem posebej poglobil v problem, je pa nastal tale zapis: require_once: PHP, PEAR, WordPress, Apache,…? problem. Danes sem se problema ponovno lotil in našel rešitev.

Problem je bil v tem, da je funkcija require_once() narobe prebrala pot do želene datoteke. Primer je spodaj:

Warning: require_once(share-widget.php) [function.require-once]: failed to open stream: No such file or directory in ��� e/www/humerca.com/wordpress/wp-content/plugins/share-and-follow/share-and-follow.php on line 1989

Fatal error: require_once() [function.require]: Failed opening required ‘share-widget.php’ (include_path=’/usr/share/pear’) in ��� e/www/humerca.com/wordpress/wp-content/plugins/share-and-follow/share-and-follow.php on line 1989

Rešitev sem našel v tem, da se odstranil pecl paket APC.

# pecl uninstall APC

Ker to ni pomagalo sem  v /etc/php.d/apc.ini zakomentiral (spredaj dodaš ;) vrstico:

extension=apc.so

require_once: PHP, PEAR, WordPress, Apache,…? problem

Imam zadnjo verzijo wordpressa 3.1.2 na CentOS 5.6 s php 5.3.6-3. Po zadnjih posodobitvah se dogaja, da določene teme in plugini v wordpressu ne delujejo oz. proizvedejo error, kot je spodaj:

[error] [client 193.77.126.109] PHP Warning:  require_once(OAuth.php) [<a href=’function.require-once’>function.require-once</a>]: failed to open stream: No such file or directory in \xd4,D\ne/www/humerca.com/wordpress/wp-content/plugins/tweet-blender/lib/twitteroauth/twitteroauth.php on line 14
[error] [client 193.77.126.109] PHP Fatal error:  require_once() [<a href=’function.require’>function.require</a>]: Failed opening required ‘OAuth.php’ (include_path=’/usr/share/pear’) in \xd4,D\ne/www/humerca.com/wordpress/wp-content/plugins/tweet-blender/lib/twitteroauth/twitteroauth.php on line 14

Datoteka OAuth.php obstaja in se nahaja v isti mapi, kot file, ki jo kliče – twitteroauth.php. Kliče se z vrstico:

class_exists(“OAuthSignatureMethod_HMAC_SHA1”) && class_exists(“OAuthSignatureMethod_RSA_SHA1”) || require_once(‘OAuth.php’);

Če spremenim require_once v tole:

class_exists(“OAuthSignatureMethod_HMAC_SHA1”) && class_exists(“OAuthSignatureMethod_RSA_SHA1”) || require_once(dirname(__FILE__).’/OAuth.php’);

potem vse deluje pravilno. Zanima me zakaj je popačena pot izpisane datoteke twitteroauth.php, ki kliče OAuth.php? Zakaj je tole:

\xd4,D\ne/www/humerca.com/…

in ne

/home/www/humerca.com/…

Kje in kako naj iščem problem? V PEAR-u? Apache?

Hvala.