Php ошибка failed opening required pear

How to include mail.php for using PHP Pear Mail. I’m using the following code in test.php file:

    require_once "Mail.php";

    $from = "<test@gmail.com>";
    $to = "<testing@gmail.com>";
    $subject = "Hi!";
    $body = "Hi,nnHow are you?";

    $host = "ssl://smtp.gmail.com";
    $port = "465";
    $username = "<testtest@gmail.com>";
    $password = "testtest";

    $headers = array ('From' => $from,
      'To' => $to,
      'Subject' => $subject);
    $smtp = Mail::factory('smtp',
      array ('host' => $host,
        'port' => $port,
        'auth' => true,
        'username' => $username,
        'password' => $password));

    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
      echo("<p>" . $mail->getMessage() . "</p>");
    } else {
      echo("<p>Message successfully sent!</p>");
    }

and the following error is encountered via this code:

  Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in D:Hosting6525150htmltest.php on line 3

  Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.;C:php5pear') in D:Hosting6525150htmltest.php on line 3

Can someone tell me what is the problem?

maler1988

Перехали на новый сервер, вылетела ошибка.

Fatal error: require_once(): Failed opening required ‘/home/bitrix/www/local/modules/custom.module/lib/exception.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/bitrix/www/bitrix/modules/main/lib/loader.php on line 313 PHP Fatal error: Uncaught Error: Class ‘BitrixMainDiagExceptionHandlerLog’ not found in /home/bitrix/www/bitrix/modules/main/lib/diag/exceptionhandler.php:350

Проверил все пути вручную, файлы на месте. На сторонних форумах нашёл такое объяснение:

If you break apart your string «.:/usr/share/pear:/usr/share/php» using that character, you will get 3 parts
. (this means the current directory your code is in)
/usr/share/pear
/usr/share/ph
Any attempts to include()/require() things, will look in these directories, in this order.

Не пойму, в моём случае require_once() пытается найти файлы в /usr/share/pear и /usr/share/php ? Какие-то настройки на сервере надо править так? Или я не верно понимаю проблему?


  • Вопрос задан

    более трёх лет назад

  • 5600 просмотров

Пригласить эксперта

/usr/share/pear и /usr/share/php — это альтернативные пути для различных библиотек.
Проверьте права на чтение здесь ‘/home/bitrix/www/local/modules/custom.module/lib/exception.php’

Скорее всего, вы не учитываете регистр файлов, который под Windows не имеет значения, а под другими ОС имеет.
Попробуйте переименовать
/bitrix/modules/main/lib/diag/exceptionhandlerlog.php
в
/bitrix/modules/main/lib/Diag/ExceptionHandlerLog.php
Ну и другие файлы также (если там используется совместимый с PSR-4 автолоадер)

По какой-то загадочной причине пользователи похапе en masse не читают подробное объяснение ошибки, предоставленное интерпретатором РНР, предпочитая гадание на кофейной гуще.

Казалось бы, объяснение прямо под носом: ищем файл в папке local

/home/bitrix/www/local/modules/custom.module/lib/exception.php

в то время как в реальности файлы приложения лежат в папке bitrix

/home/bitrix/www/bitrix/modules/main/lib/loader.php

То есть можно предположить банально неверную конфигурацию приложения.


  • Показать ещё
    Загружается…

09 июн. 2023, в 01:21

10000 руб./за проект

09 июн. 2023, в 01:06

50000 руб./за проект

09 июн. 2023, в 00:36

1000 руб./за проект

Минуточку внимания

In this comprehensive guide, we will discuss how to solve the fatal error: require_once() failed opening required. This error is commonly encountered by PHP developers and can be frustrating to deal with. Following our step-by-step guide, you will be able to resolve this error quickly and efficiently.

Table of Contents

  1. Understanding the Error
  2. Common Causes of the Error
  3. Step-by-Step Solution
  4. FAQs
  5. Related Links

Understanding the Error

The require_once() function is used to include a PHP file in another PHP file. It ensures that the included file is only included once during the execution of the script. If the file cannot be found or opened, the require_once() function will trigger a fatal error and halt the execution of the script.

The error message might look something like this:

Fatal error: require_once(): Failed opening required 'path/to/your/file.php' (include_path='.:/usr/local/php/pear') in /home/user/public_html/index.php on line 10

In this guide, we will focus on resolving the «Failed opening required» part of the error message.

Back to top ↑

Common Causes of the Error

The «Failed opening required» error is usually caused by one of the following reasons:

  1. The file path specified in the require_once() function is incorrect.
  2. The file you are trying to include does not exist or has been deleted.
  3. The file permissions are incorrect, preventing the file from being accessed.
  4. The PHP include_path configuration is incorrect.

Back to top ↑

Step-by-Step Solution

Follow these steps to resolve the «Failed opening required» error:

Step 1: Verify the File Path

First, check if the file path specified in the require_once() function is correct. Ensure that you are using the right path, either absolute or relative, to the file you want to include.

For example, if your file structure looks like this:

- public_html/
    - index.php
    - includes/
        - config.php

Your require_once() function in the index.php file should look like this:

require_once('includes/config.php');

Step 2: Check if the File Exists

Make sure the file you are trying to include actually exists. Double-check the file’s location and verify that it has not been accidentally deleted or moved.

Step 3: Verify File Permissions

Check the file permissions of the file you are trying to include. The file should have read access for the user running the PHP script. You can change the file permissions using an FTP client or a command-line interface.

For example, to set the correct file permissions using the command line, navigate to the directory containing the file and run the following command:

chmod 644 config.php

Step 4: Check PHP include_path

If you have checked the file path, verified that the file exists, and ensured that the file has the correct permissions, but you are still encountering the error, the issue might be with the PHP include_path configuration.

You can check the current include_path by creating a new PHP file with the following content:

<?php
phpinfo();
?>

Run the script and look for the include_path entry in the «PHP Core» section. If the include_path is incorrect, you can change it in your php.ini file or by using the set_include_path() function in your PHP script.

After following these steps, the «Failed opening required» error should be resolved.

Back to top ↑

FAQs

1. What is the difference between require_once() and include_once()?

The main difference between require_once() and include_once() is the behavior when the specified file cannot be found or opened. require_once() triggers a fatal error and halts the script execution, while include_once() triggers a warning and continues to execute the script.

2. When should I use require_once() instead of include() or require()?

You should use require_once() when you want to include a file that contains important functions or configurations that your script relies on, and you want to ensure that the file is only included once during the script execution.

3. Can I use a URL in the require_once() function?

No, you cannot use a URL in the require_once() function. It only works with local file paths.

4. What are the security risks of using require_once()?

The security risks of using require_once() are minimal if you use it to include your own files. However, if user input is used to determine the file to include, it can lead to a security vulnerability called «Local File Inclusion (LFI).» Always validate and sanitize user input before using it in your require_once() function.

5. How can I debug require_once() issues?

To debug require_once() issues, you can use the following techniques:

  1. Use the file_exists() function to check if the file exists before including it.
  2. Use the is_readable() function to check if the file is readable before including it.
  3. Use the error_reporting() function to enable error reporting and display errors.

Back to top ↑

  1. PHP: require_once — Manual
  2. PHP: include_once — Manual
  3. Understanding PHP File Permissions and Ownership
  4. PHP: set_include_path — Manual
  5. PHP: Local File Inclusion (LFI) — OWASP

Back to top ↑

За последние 24 часа нас посетили 12248 программистов и 878 роботов. Сейчас ищут 572 программиста …


  1. yura29

    С нами с:
    16 июл 2013
    Сообщения:
    11
    Симпатии:
    0

    В php я новичок и поэтому не особо понимаю в чем моя ошибка

    Поставил денвер с php 5.3 и пакет расширений
    Накатил DLE 9.8
    И всё работает, но мне нужно влепить еще одну маленькую cms модулем
    Сам DLE и cms по отдельности работают, но стоит мне впилить эту cms в окно {content} сайта, как всё крашится с ошибкой

    Fatal error: require_once(): Failed opening required ‘./smarty/libs/Smarty.class.php’ (include_path=’.;Z:usrlocalphp5pear;/usr/local/php5/PEAR’) in Z:homesite.comwwwcabinetindex.php on line 4

    Сама cms использует для работы smarty
    И я сначала подумал, что этот smarty конфликтует с каким-нибудь API, но такая ошибка появляется всегда, как в основном файле модуля появляется команда require_once

    Помогите решить проблему позязя))

    Вот сам основной файл подключаемого модуля

    1. define(‘INCLUDE_CHECK’,true);
    2. require_once(‘./smarty/libs/Smarty.class.php’);
    3. include (‘./include/config.php’);
    4. include (‘./include/kassa_config.php’);
    5. include (‘./include/func.php’);
    6. $path = dirname(__FILE__);
    7. $logger = new Logger(«./mcshop.log»);
    8. $log_date = «[» . date(«d/m/Y H:i») . «] «;
    9. $q = mysql_query(«SELECT `value` FROM `settings` WHERE `name`=’theme’;»,$sql);
    10. $theme = mysql_result($q,0);
    11. $theme_path = ‘./theme/’.$theme.’/’;
    12. $tpl->template_dir = $theme_path;
    13. $tpl->compile_dir = ‘./cache/’;
    14. $tpl->cache_dir = ‘./cache/’;
    15. $tpl->assign(‘path’, $theme_path);
    16. if(empty($_SESSION[‘id’])) {
    17.     // Тут делаем авторизацию
    18.     $tpl->assign(‘title’, ‘Авторизация’);
    19.     if(isset($_GET[‘error’])) {
    20.         $tpl->assign(‘errno’, ‘Неверный логин или пароль!’);
    21.         $logger->WriteLine($log_date . «Неудачная попытка авторизации с ip: » . $_SERVER[‘REMOTE_ADDR’]);
    22.     $tpl->assign(‘title’, ‘Личный Кабинет’);
    23.     $tpl->display(‘guest.tpl’);
    24.     $username = mysql_real_escape_string($_SESSION[‘name’]);
    25.     $right = privelegie($username, $db_users, $db_users_name, $sql);
    26.     $q = mysql_query(«SELECT money FROM {$db_users} WHERE {$db_users_name}=’$username’;»,$sql);
    27.     $tpl->assign(‘money’, mysql_result($q,0));
    28.     $tpl->assign(‘username’, $username);
    29.     $q = mysql_query(«SELECT value FROM settings WHERE name=’ip’ OR name=’port’;»,$sql);
    30.     $ip = mysql_result($q,0);
    31.     $port = mysql_result($q,1);
    32.     $settings = GetSettings($sql);
    33.     $server = Server($ip,$port);
    34.     if(!isset($server[‘name’])) $server[‘name’] = ‘Неопознанно’;
    35.     $tpl->assign(«shop_id»,$shop_id);
    36.     $tpl->assign(«right»,$right);
    37.     $tpl->assign(«map_enabled»,$settings[‘map_enabled’]);
    38.     $tpl->assign(‘srv_name’, $server[‘name’]);
    39.     $tpl->assign(‘ip’, ‘ip=’.$ip.’&port=’.$port);
    40.     $tpl->assign(‘navigation’, ‘menu.tpl’);
    41.     if(!isset($_GET[‘page’]) || $_GET[‘page’] == ») {
    42.         $tpl->assign(‘title’, ‘Личный Кабинет’);
    43.         $tpl->assign(‘content’, ‘skin.tpl’);
    44.         include(«./modules/blocks_main.php»);
    45.         include(«./modules/skin.php»);
    46.         include(«./modules/cp.php»);
    47.         $tpl->assign(‘welcome1’, ‘Добро пожаловать ‘.$username.’!’);
    48.         $tpl->assign(‘welcome2’, ‘Это ваш личный кабинет на игровом сервере ‘.$server[‘name’]);
    49.         $full_path = ‘./theme/’.$theme.’/’.$_GET[‘page’].’.tpl’;
    50.         if(!file_exists($full_path)) {
    51.             $tpl->assign(‘title’, ‘Ошибка 404’);
    52.             $tpl->assign(‘content’, ‘error.tpl’);
    53.             $tpl->assign(‘welcome1’, ‘Ошибка 404’);
    54.             $tpl->assign(‘welcome2’, »);
    55.         if($_GET[‘page’] == ‘buy’) {
    56.             $tpl->assign(‘title’, ‘Покупка статуса’);
    57.             include(«./modules/buy.php»);
    58.             $tpl->assign(‘welcome1’, ‘Покупка статуса’);
    59.             $tpl->assign(‘welcome2’, ‘Здесь вы можете купить игровой статус’);
    60.         if($_GET[‘page’] == ‘skin’) {
    61.             $tpl->assign(‘title’, ‘Сменить скин’);
    62.             include(«./modules/skin.php»);
    63.             $tpl->assign(‘content’, ‘skin.tpl’);
    64.             $tpl->assign(‘welcome1’, ‘Смена скина’);
    65.             $tpl->assign(‘welcome2’, ‘Здесь вы можете изменить свой игровой скин’);
    66.         if($_GET[‘page’] == ‘support’) {
    67.             $tpl->assign(‘title’, ‘Техническая поддержка’);
    68.             include(«./modules/support.php»);
    69.             $tpl->assign(‘content’, ‘support.tpl’);
    70.             $tpl->assign(‘welcome1’, ‘Тех поддержка’);
    71.             $tpl->assign(‘welcome2’, ‘Здесь вы можете написать в тех. поддержку’);
    72.         if($_GET[‘page’] == ‘cp’) {
    73.             $tpl->assign(‘title’, ‘Дополнительные услуги’);
    74.             include(«./modules/cp.php»);
    75.             $tpl->assign(‘welcome1’, ‘Дополнительные услуги’);
    76.             $tpl->assign(‘welcome2’, ‘Здесь вы можете воспользоваться другими услугами сервера’);
    77.         if($_GET[‘page’] == ‘admin’) {
    78.             $tpl->assign(‘title’, ‘Панель администратора’);
    79.             include(«./modules/admin.php»);
    80.             $tpl->assign(‘welcome1’, ‘Панель администратора’);
    81.             $tpl->assign(‘welcome2’, ‘Здесь вы можете управлять магазином в зависимости от Ваших прав’);
    82.         if($_GET[‘page’] == ‘map’) {
    83.             $tpl->assign(‘title’, ‘Карта сервера’);
    84.             include(«./modules/map.php»);
    85.             $tpl->assign(‘welcome1’, ‘Карта сервера’);
    86.             $tpl->assign(‘welcome2’, ‘Здесь вы можете увидеть карту сервера’);
    87.         if($_GET[‘page’] == ‘blocks’) {
    88.             $tpl->assign(‘title’, ‘Продажа блоков’);
    89.             include(«./modules/blocks.php»);
    90.             $tpl->assign(‘welcome1’, ‘Продажа блоков’);
    91.             $tpl->assign(‘welcome2’, ‘Здесь вы можете купить необходимыа Вам для игры блоки’);
    92.         // Для интерфейсов оплаты
    93.         if($_GET[‘page’] == ‘success’) {
    94.             $tpl->assign(‘title’, ‘Пополнение счета’);
    95.             include(«./kassa/success.php»);
    96.             $tpl->assign(‘welcome1’, ‘Пополнение счета’);
    97.             $tpl->assign(‘welcome2’, »);
    98.         if($_GET[‘page’] == ‘fail’) {
    99.             $tpl->assign(‘title’, ‘Пополнение счета’);
    100.             include(«./kassa/fail.php»);
    101.             $tpl->assign(‘welcome1’, ‘Пополнение счета’);
    102.             $tpl->assign(‘welcome2’, »);
    103.         if($_GET[‘page’] == ‘quit’) {
    104.             header(«Location: index.php»);
    105.     $tpl->display(‘main.tpl’);


  2. iliavlad

    iliavlad
    Активный пользователь

    С нами с:
    24 янв 2009
    Сообщения:
    1.689
    Симпатии:
    4

    Re: [Помогите] Fatal error: require_once()

    у тебя в папке Z:homesite.comwwwcabinet есть папка smarty ?


  3. yura29

    С нами с:
    16 июл 2013
    Сообщения:
    11
    Симпатии:
    0

    Re: [Помогите] Fatal error: require_once()

    да
    и папка и все файлы имеются


  4. artoodetoo

    Команда форума
    Модератор

    С нами с:
    11 июн 2010
    Сообщения:
    10.918
    Симпатии:
    1.198
    Адрес:
    там-сям

    require/include ищут файл относительно папки с «точкой входа», а не относительно папки с файлом в котором стоит этот require/include.

    поясню:
    если наш запрос обрабатывается файлом
    Z:homesite.comwwwindex.php
    который подключает, например файл ‘./cabinet/ololo.php’ , то есть уже
    Z:homesite.comwwwcabinetololo.php
    а тот, в свою очередь пытается подключить ‘./smarty/libs/Smarty.class.php’ , то этот файл будет искаться в
    Z:homesite.comwwwsmartylibsSmarty.class.php — относительно первого файла!!! никаких «cabinet» здесь уже не наблюдаем

    Добавлено спустя 5 минут 13 секунд:
    хотите инклудить относительно текущего файла? делайте так:

    1. include __DIR__.‘/path/to/file.php’; // начиная с PHP 5.3   

    или

    1. include dirname(__FILE__).‘/path/to/file.php’; // во всех версиях PHP   

    Добавлено спустя 3 минуты 57 секунд:p.s. ты глянь в свой код, там даже есть готовая переменная $path, которую ты можешь использовать для «умного» инклуда :)


  5. yura29

    С нами с:
    16 июл 2013
    Сообщения:
    11
    Симпатии:
    0

    Re: [Помогите] Fatal error: require_once()

    Спасибо вам огромное))
    Благодаря вам сэкономил кучу времени

    Адреса поправил в основном фале руками, но есть ли какой нибудь инструмент, который исправит это автоматически?


  6. artoodetoo

    Команда форума
    Модератор

    С нами с:
    11 июн 2010
    Сообщения:
    10.918
    Симпатии:
    1.198
    Адрес:
    там-сям

    а не надо автоматически. думать надо и индивидуально решать.


  7. yura29

    С нами с:
    16 июл 2013
    Сообщения:
    11
    Симпатии:
    0

  8. вобще, достаточно было убрать «./»…

    относительно include path они ищут файл

PHP � Errors � Failed opening
required ‘PEAR.php’

Reason:

� — PHP can’t
find PEAR.php when it gets to line require_once(‘PEAR.php’); because PEAR is not installed.

Solution:

� — If your
PHP insallation has C:InstalledProgrammingPHP528PEARgo-pear.phar PEAR can
be installed using:

� ��cd C:PHP528PEAR

� ��php -d phar.require_hash=0
go-pear.phar

� ��Are you installing a
system-wide PEAR or a local copy?

� ��(system|local) [system] : local

� ��Please confirm local copy by
typing ‘yes’ : yes

� ��

� ��Below is a suggested file
layout for your new PEAR installation.� To

� ��change individual locations,
type the number in front of the

� ��directory.� Type ‘all’ to
change all of them or simply press Enter to

� ��accept these locations.

� ��

� ���1. Installation base
($prefix)������������������ : C:PHP528PEAR

� ���2. Temporary directory for
processing����������� : C:PHP528PEARtmp

� ���3. Temporary directory for
downloads������������ : C:PHP528PEARtmp

� ���4. Binaries
directory��������������������������� : C:PHP528PEAR

� ���5. PHP code directory
($php_dir)���������������� : C:PHP528PEARpear

� ���6. Documentation
directory�������� ��������������: C:PHP528PEARdocs

� ���7. Data
directory������������������������������� : C:PHP528PEARdata

� ���8. User-modifiable
configuration files directory : C:PHP528PEARcfg

� ���9. Public Web Files
directory������������������� : C:PHP528PEARwww

� ��10. Tests
directory������������������������������ : C:PHP528PEARtests

� ��11. Name of configuration
file������������������� : C:PHP528PEARpear.ini

� ��12. Path to CLI
php.exe�������������������������� : C:PHP528

� ��

� ��1-12, ‘all’ or Enter to
continue: (Enter)

� ��Beginning install…

� ��Configuration written to
C:PHP528PEARpear.ini…

� ��Initialized registry…

� ��Preparing to install…

� ��installing
phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.2.tar…

� ��installing
phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar…

� ��installing
phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.7.2.tar…

� ��installing
phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar…

� ��pear/PEAR can optionally use
package «pear/XML_RPC» (version >= 1.4.0)

� ��install ok:
channel://pear.php.net/Archive_Tar-1.3.2

� ��install ok:
channel://pear.php.net/Console_Getopt-1.2.3

� ��install ok:
channel://pear.php.net/Structures_Graph-1.0.2

� ��install ok:
channel://pear.php.net/PEAR-1.7.2

� ��PEAR: Optional feature
webinstaller available (PEAR’s web-based installer)

� ��PEAR: Optional feature
gtkinstaller available (PEAR’s PHP-GTK-based installer)

� ��PEAR: Optional feature
gtk2installer available (PEAR’s PHP-GTK2-based installer)

� ��PEAR: To install optional features
use «pear install pear/PEAR#featurename»

� ��

� ��******************************************************************************

� ��WARNING!� The include_path
defined in the currently used php.ini does not

� ��contain the PEAR PHP
directory you just specified:

� ��<C:PHP528PEARpear>

� ��If the specified directory is
also not in the include_path used by

� ��your scripts, you will have
problems getting any PEAR packages working.

� ��

� ��

� ��Would you like to alter
php.ini <C:PHP528php.ini>?
[Y/n] : Y

� ��php.ini <C:PHP528php.ini>
include_path updated.

� ��

� ��Current include
path���������� : .;C:php5pear

� ��Configured
directory���������� : C:PHP528PEARpear

� ��Currently used php.ini
(guess) : C:PHP528php.ini

� ��Press Enter to continue: (Enter)

� ��** WARNING! Old version found
at C:PHP528PEAR, please remove it or be sure to use the new
c:php528pearpear.bat

� ���command

� ��

� ��The ‘pear’ command is now at
your service at c:php528pearpear.bat

� ��

� ��** The ‘pear’ command is not
currently in your PATH, so you need to

� ��** use
‘c:php528pearpear.bat’ until you have added

� ��** ‘C:PHP528PEAR’ to your
PATH environment variable.

� ��

� ��Run it without parameters to
see the available actions, try ‘pear list’

� ��to see what packages are
installed, or ‘pear help’ for help.

� ��

� ��For more information about
PEAR, see:

� ��

� ����http://pear.php.net/faq.php

� ����http://pear.php.net/manual/

� ��

� ��Thanks for using go-pear!

Залил сайт на хостинг и вылезла ошибка:

PHP Fatal error: require_once(): Failed opening required '/public_html/system/startup.php' (include_path='.:/opt/php71/share/pear:/usr/share/pear') in /home/c/cr53142/public_html/index.php on line 17.

Как убрать?

Похожие вопросы

Установка opencart на хостинг

Я установил версию opencart через timeweb а она там далеко не последняя. Смотрю гайды и у в 3.0.8.0 если не ошибаюсь дизайн гораздо ингтереснее ,выпадающие меню,красивые кнопки. Вобщем я решил удалить сайт подчистую все удалил через ftp осталась только…

milan

02 марта в 2022


1.4K

Взял заказ на фрилансе CMS Opencart

Здравствуйте. Я взял первый свой заказ на фрилансе, но не знаю как зайти в админку opencart. Помогите пожалуйста.

htacсess не хочет переадресовывать урлы с index.php/

Здравствуйте !

Перевожу старый сайт со сторонней cms на новый сайт — движок opencart
Делаю переадресацию в .htacess
Иногда нужно переадресовывать подобные урлы 
index.php/cat/c706_Derevo-schastya.html

Делаю таким образом — не срабатывает
RewriteCond…

Ваш баланс 10 ТК

1 ТК = 1 ₽

О том, как заработать и потратить Таймкарму, читайте в этой статье

Чтобы потратить Таймкарму, зарегистрируйтесь на нашем сайте

Инструкции по восстановлению пароля высланы на Ваш адрес электронной почты.

Войти в Комьюнити

Регистрация в Комьюнити

Восстановление пароля


Go to PHPhelp


r/PHPhelp

Post specific problems or questions you have about PHP or your code. Hopefully, someone will be able to help you out!

Please contribute back and help others :)




Members





Online



by

[deleted]



how do i fix this error: Fatal error: require_once(): Failed opening required ‘PEAR.php’ (include_path=’.;C:phppear’)

when i run this: http://localhost/EventCalenderPHP/Sourcescode/demo.php

i get this error:

Warning: require_once(PEAR.php): failed to open stream: No such file or directory in C:xampphtdocsEventCalenderPHPSourcescodeincludesMail.php on line 46

Fatal error: require_once(): Failed opening required ‘PEAR.php’ (include_path=’.;C:phppear’) in C:xampphtdocsEventCalenderPHPSourcescodeincludesMail.php on line 46

https://github.com/cherishsantosh/EventCalenderPHP

0 Пользователей и 1 Гость просматривают эту тему.

  • 22 Ответов
  • 10435 Просмотров

Здравствуйте.
Бился пару часов, решение не нашел.
При попытке подключить код sape, не важно каким способом (модуль php, плагин php)
получаю ошибку

Warning: require_once(/var/www/user/data/www/site.ru) [function.require-once]: failed to open stream: No such file or directory in /var/www/user/data/www/site.ru/tmp/html4SUZ7M on line 5

Fatal error: require_once() [function.require]: Failed opening required » (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/site/data/www/site.ru/tmp/html4SUZ7M on line 5

Обычный сайт, ничем от других не отличается, но других все работает, здесь не хочет…
Все модули и плагины отключал — ничего не дает…

Я так понимаю, проблема в подключении файла, поскольку простые команды типа <?php echo «test»; ?> в модуле выводятся и сайт не вешается.

Я код вставляю через Sourcerer в обычный HTML-модуль. Не пробовали? Точно SAPE-ошибка?

Записан

Я рифме друг словесной. Тут
Свой упражняю словоблуд:
Блог Ecolora

Я код вставляю через Sourcerer в обычный HTML-модуль. Не пробовали? Точно SAPE-ошибка?

Пытался выставить код через sape модуль, через flexi custom code и через Sourcerer.

Конкретно через Sourcerer — такая ошибка

Warning: require_once(/var/www/user/data/www/site.ru) [function.require-once]: failed to open stream: No such file or directory in /var/www/user/data/www/site.ru/plugins/system/sourcerer/helper.php(464) : runtime-created function on line 10

Fatal error: require_once() [function.require]: Failed opening required » (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/user/data/www/site.ru/plugins/system/sourcerer/helper.php(464) : runtime-created function on line 10

А код какой? Приведите, можете имя папки поменять, остальное как есть

Записан

Я рифме друг словесной. Тут
Свой упражняю словоблуд:
Блог Ecolora

А код какой? Приведите, можете имя папки поменять, остальное как есть

Да стандратный код сапы, модуль-то саповский тоже не пашет…

<?php
     if (!defined('_SAPE_USER')){
        define('_SAPE_USER', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
     }
     require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));
     $sape = new SAPE_client();

    echo $sape->return_links(); ?>

Более того, вставляю код прямо в шаблон — та же проблема…

« Последнее редактирование: 13.08.2013, 12:31:03 от romagromov »

Записан

Вы где это взяли?

require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));

Замените на:

require_once($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php');

Вообще вот так выглядит код для сайта (если там не используется sef-компонент):

<?php
if (!defined('_SAPE_USER')){
define('_SAPE_USER', '97810bddb8548ec401');
}
require_once($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php');
$o['charset'] = 'UTF-8';
$sape = new SAPE_client($o);
unset($o);
echo $sape->return_links();
?>

Записан

Я рифме друг словесной. Тут
Свой упражняю словоблуд:
Блог Ecolora

Вы где это взяли?

require_once(realpath($_SERVER['DOCUMENT_ROOT'].'/'._SAPE_USER.'/sape.php'));

Это взял там где это раздают ))

В любом случае, ваш вариант тоже не срабатывает…

Этот код работает на других таких же сайтах, на этом же сервере.
Модули, плагины отключал, в шаблон включал, что-то еще до самой Joomla происходит…

« Последнее редактирование: 13.08.2013, 14:23:04 от romagromov »

Записан

Начинаю что-то понимать…

Ошибка

Warning: require_once(/var/www/vipyalta/data/www/vipyalta.ru/2561d610b443b6a0b52fa10979a5c837/sape.php) [function.require-once]: failed to open stream: No such file or directory in /tmp/htmlGSwlRN on line 5

Fatal error: require_once() [function.require]: Failed opening required '/var/www/vipyalta/data/www/vipyalta.ru/2561d610b443b6a0b52fa10979a5c837/sape.php' (include_path='.:/usr/share/php:/usr/share/pear') in /tmp/htmlGSwlRN on line 5

Но 2561d610b443b6a0b52fa10979a5c837 — это не мой номер…

Нашел папку /var/www/user/data/www/site.ru/administrator/components/2561d610b443b6a0b52fa10979a5c837
а в ней sape.php и links.db

Какая-то мразь, торгует ссылками с моего сайта

И видимо, где-то стоит редирект на эту папку, что ли…
Пока не знаю, как это найти…

Хех, не знал, что они код поменяли. А я свой ставлю везде и работает.

Успехов Вам с поиском мрази! ))

Я предлагаю обратиться в SAPE и пожаловаться на аккаунт с папкой 2561d610b443b6a0b52fa10979a5c837.

Приложить скриншоты.

Чтобы его заблокировали и в следующий раз неповадно было.

Записан

Я рифме друг словесной. Тут
Свой упражняю словоблуд:
Блог Ecolora

Хех, не знал, что они код поменяли. А я свой ставлю везде и работает.

Успехов Вам с поиском мрази! ))

Я предлагаю обратиться в SAPE и пожаловаться на аккаунт с папкой 2561d610b443b6a0b52fa10979a5c837.

Приложить скриншоты.

Чтобы его заблокировали и в следующий раз неповадно было.

Это понятно, надло сначала привести в порядок сайт. Удаляю папку 2561d610b443b6a0b52fa10979a5c837 — сайт тоже падает, только не полностью, шаблон слетает…
Спасибо за участие.

Короче, человек инкладом вставляет свой файл с прописанным кодом в шаблонах сайта, маскируя под CSS и так далее.
Беглым взглядом не заметишь.

Мне пришло как-то письмо из дата центра, о том что 2.5 ломают банальным перебором паролей на входе в админку.
Ставлю пароль на папку теперь…

Ну если не можете себе иного позволить… Я RSFirewall-ом лицензионным пользуюсь.

Ссылка реферальная. Надо же его как-то отрабатывать. ;)

Записан

Я рифме друг словесной. Тут
Свой упражняю словоблуд:
Блог Ecolora

Ну если не можете себе иного позволить… Я RSFirewall-ом лицензионным пользуюсь.

Ссылка реферальная. Надо же его как-то отрабатывать. ;)

Логи атак ведет?
Изменения в файловой структуре фиксирует?

Думал admin tools поставить

Да, и изменения и логи и много чего.

Записан

Я рифме друг словесной. Тут
Свой упражняю словоблуд:
Блог Ecolora

Прошу помощи!.. не могу разобраться с кодом контекстных ссылок.. Обычные сслки работают нормально, а вот с контекстными проблема -их не видит система…Может я что то не так сделал — поправьте ..Итак по порядку  —  Я в файл

Корневая папка /.. /templates/beez_20/index.php перед тегом <head> , но после открывающего тега <html…>( так как в другое место, куда не вставлял — выдавало ошибку? но в принципе всё по инструкции) вставил код
<?php
if (!defined(‘_SAPE_USER’)){
define(‘_SAPE_USER’, ‘531e307c85c6b69ff02377439cac4978’);
}
require_once(realpath($_SERVER[‘DOCUMENT_ROOT’].’/’._SAPE_USER.’/sape.php’));
$sape_context = new SAPE_context();
ob_start(array(&$sape_context,’replace_in_page’));
?>

так как простые ссылки у меня идут через модуль — то ничего не менял в коде для простых ссылок( его просто нет), и поставил после тега
<body>

<sape_index>


</sape_index>

</body>

</html>

Только после индексации контекстных страниц не появилось..
В чём ошибка — помогите!!

Обычные ссылки — всё работает! А код контекстных система почему то не видит.

Кто-нибудь может помочь разобраться?

Кто-нибудь может помочь разобраться?

Вам надо писать поддержку sape

Вам надо писать поддержку sape

  вы думаете не писал?  Они написали, что скорее всего некорректно вставлен код, хотя я сделал всё по инструкции.. на форуме sape, где я также просил помощи, на то что не работают контекстные ссылки, ответ был таков — ну и бог с ними…

 вы думаете не писал?  Они написали, что скорее всего некорректно вставлен код, хотя я сделал всё по инструкции.. на форуме sape, где я также просил помощи, на то что не работают контекстные ссылки, ответ был таков — ну и бог с ними…

Ну и правильно написали ))
Я как-то тоже бился долго очень на одном сайте, сапа  все таки проиндексировала страницы для контекстных ссылок и их даже начали покупать, но они не отображались в статьях.
Однако, их было такое мизерное количество, что у меня отпало желания добить проблему с их отображением. Допустим на 300-400 обычных ссылок, приходила 1 заявка на контекстные ссылки.
Короче оно, того не стоит. Весьма не популярная услуга на sape.

Ну и правильно написали ))
Я как-то тоже бился долго очень на одном сайте, сапа  все таки проиндексировала страницы для контекстных ссылок и их даже начали покупать, но они не отображались в статьях.
Однако, их было такое мизерное количество, что у меня отпало желания добить проблему с их отображением. Допустим на 300-400 обычных ссылок, приходила 1 заявка на контекстные ссылки.
Короче оно, того не стоит. Весьма не популярная услуга на sape.

Ну вот хоть один вразумительный ответ.. Спасибо! теперь и я не буду париться… но хоть бы кто-нибудь раньше написал… молчат..ещё раз спасибо!!

Ну и правильно написали ))

Короче оно, того не стоит. Весьма не популярная услуга на sape.

  Последний вопрос — а для какого ресурса такая услуга популярна?

  Последний вопрос — а для какого ресурса такая услуга популярна?

Оптимизаторы больше отдают предпочтение ссылкам в статьях, то есть закупают целые статьи, чем автоматическим контекстным ссылкам. Для этого есть различные биржи.

Оптимизаторы больше отдают предпочтение ссылкам в статьях, то есть закупают целые статьи, чем автоматическим контекстным ссылкам. Для этого есть различные биржи.

  Ну я так примерно и думал..спасибо

Понравилась статья? Поделить с друзьями:
  • Php ошибка 500 как вывести
  • Php ошибка 404 не найдено
  • Php ошибка 200 что это
  • Phpmyadmin ошибка конфигурация уже существует настройка отключена
  • Php отобразить ошибки на странице