• 28-09-2023, 23:30:17
    #1
    file_put_contents
    HATASI ALıyorum forumumda , bu fonksiyonu php üzerinde nasıl aktif edebilirim veya
    olup olmadığını çalışıp çalışmadığını nasıl sorgulayabilirim.
  • 28-09-2023, 23:32:27
    #2
    Backend Developer
    yazdığınız kodda bir sorun olabilirmi hocam
    kodları burda paylaşabilirmisiniz
  • 28-09-2023, 23:33:00
    #3
    Hatayi buraya yazarmisiniz
  • 28-09-2023, 23:35:21
    #4
    LENOX adlı üyeden alıntı: mesajı görüntüle
    yazdığınız kodda bir sorun olabilirmi hocam
    kodları burda paylaşabilirmisiniz
    M_D_5 adlı üyeden alıntı: mesajı görüntüle
    Hatayi buraya yazarmisiniz
    public function write($path, $contents, Config $config)
    {
    $location = $this->applyPathPrefix($path);
    $this->ensureDirectory(dirname($location));

    if (($size = file_put_contents($location, $contents, $this->writeFlags)) === false) {
    return false;
    }

    $type = 'file';
    $result = compact('contents', 'type', 'size', 'path');

    if ($visibility = $config->get('visibility')) {
    $result['visibility'] = $visibility;
    $this->setVisibility($path, $visibility);
    }

    return $result;
    }
    -------------
    • ErrorException: [E_WARNING] file_put_contents(/var/www/vhosts/xxx.net/httpdocs/internal_data/code_cache/templates/l0/s33/public/_ads.php): failed to open stream: No such file or directory
    • src/vendor/league/flysystem/src/Adapter/Local.php:135
    #0 [internal function]: XF::handlePhpError(2, '[E_WARNING] fil...', '/var/www/vhosts...', 135, Array)
    #1 src/vendor/league/flysystem/src/Adapter/Local.php(135): file_put_contents('/var/www/vhosts...', '<?php
    // FROM H...', 2)
    #2 src/vendor/league/flysystem/src/Filesystem.php(102): LeagueFlysystemAdapterLocal->write('templates/l0/s3...', '<?php
    // FROM H...', Object(LeagueFlysystemConfig))
    #3 [internal function]: LeagueFlysystemFilesystem->put('templates/l0/s3...', '<?php
    // FROM H...', Object(LeagueFlysystemConfig))
    #4 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(431): call_user_func_array('League\Flysyste...', Array)
    #5 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(395): LeagueFlysystemEventableFilesystemEventableFilesys tem->callFilesystemMethod('put', Array)
    #6 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(57): LeagueFlysystemEventableFilesystemEventableFilesys tem->delegateMethodCall('put', Array)
    #7 src/vendor/league/flysystem/src/MountManager.php(597): LeagueFlysystemEventableFilesystemEventableFilesys tem->put('templates/l0/s3...', '<?php
    // FROM H...', Array)
    #8 src/XF/Util/File.php(225): LeagueFlysystemMountManager->put('templates/l0/s3...', '<?php
    // FROM H...', Array)
    #9 src/XF/Service/Template/Compile.php(146): XFUtilFile::writeToAbstractedPath('code-cache://te...', '<?php
    // FROM H...')
    #10 src/XF/Service/Template/Compile.php(43): XFServiceTemplateCompile->writeCompiled(Object(XFEntityTemplate), 'code-cache://te...', 'return array(
    '...')
    #11 src/XF/Job/TemplateRebuild.php(87): XFServiceTemplateCompile->recompile(Object(XFEntityTemplate))
    #12 src/XF/Job/Atomic.php(40): XFJobTemplateRebuild->run(8)
    #13 src/XF/Job/Manager.php(260): XFJobAtomic->run(8)
    #14 src/XF/Job/Manager.php(202): XFJobManager->runJobInternal(Array, 8)
    #15 src/XF/Job/Manager.php(86): XFJobManager->runJobEntry(Array, 8)
    #16 src/XF/Admin/Controller/Tools.php(141): XFJobManager->runQueue(true, 8)
    #17 src/XF/Mvc/Dispatcher.php(352): XFAdminControllerTools->actionRunJob(Object(XFMvcParameterBag))
    #18 src/XF/Mvc/Dispatcher.php(259): XFMvcDispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XFMvcRouteMatch), Object(XFAdminControllerTools), NULL)
    #19 src/XF/Mvc/Dispatcher.php(115): XFMvcDispatcher->dispatchFromMatch(Object(XFMvcRouteMatch), Object(XFAdminControllerTools), NULL)
    #20 src/XF/Mvc/Dispatcher.php(57): XFMvcDispatcher->dispatchLoop(Object(XFMvcRouteMatch))
    #21 src/XF/App.php(2487): XFMvcDispatcher->run()
    #22 src/XF.php(524): XFApp->run()
    #23 admin.php(13): XF::runApp('XF\Admin\App')
    #24 {main}
  • 28-09-2023, 23:43:54
    #5
    Selamlar,

    file_put_content fonksiyonu vardır ondan yana bir problem olmaz fakat hata almanın başlıca sebebi sunucuda yazmak istediğin konumda yazma izni açık olmayabilir onu kontrol edersen güzel olur.

    Kolay gelsin
  • 28-09-2023, 23:45:04
    #6
    LENOX adlı üyeden alıntı: mesajı görüntüle
    yazdığınız kodda bir sorun olabilirmi hocam
    kodları burda paylaşabilirmisiniz
    M_D_5 adlı üyeden alıntı: mesajı görüntüle
    Hatayi buraya yazarmisiniz
    MeteBeey adlı üyeden alıntı: mesajı görüntüle
    Selamlar,

    file_put_content fonksiyonu vardır ondan yana bir problem olmaz fakat hata almanın başlıca sebebi sunucuda yazmak istediğin konumda yazma izni açık olmayabilir onu kontrol edersen güzel olur.

    Kolay gelsin
    Tüm izinleri parça parça değiştirdim test edip problem çözüldü. 777 yaptım.
    fakat izinleri daha öncesinde denemiştim elbette olmamıştı belkide yanlış dosyayı seçtim
    tekrardan cevap yazan arkadaşlara teşekür ediyorum
    herkesin ellerine sağlık