Coder Social home page Coder Social logo

Comments (8)

luceos avatar luceos commented on June 10, 2024

I don't think Flarum has any relation to the file_get_contents in your snippet. Can you move that api call above the return [] array and see if the same timeout is generated or not?

from framework.

garygreen avatar garygreen commented on June 10, 2024

@luceos Even if I put it in a middleware it has the same problem. I've actually solved this by running fastCGI on a different port for Flarum and the other Laravel app. So it is as I suspected - something to do with conflicting env environments with Flarum and the other Laravel app. Maybe this isn't a problem specific to Flarum, though I think it may help if Flarum had a way of caching the config.

from framework.

garygreen avatar garygreen commented on June 10, 2024

See this comment recommending cached config, as that bypasses DotEnv loading during bootstrapping which could resolve this: vlucas/phpdotenv#219 (comment)

Is there any plans to add php flarum config:cache ?

from framework.

SychO9 avatar SychO9 commented on June 10, 2024

See this comment recommending cached config, as that bypasses DotEnv loading during bootstrapping which could resolve this: vlucas/phpdotenv#219 (comment)

Flarum doesn't use DotEnv, nor does it cache the config in that sense so a config:cache command does not make sense here, I believe you are dealing with a different issue on your server, as what you are referring to is a laravel-specific issue.

from framework.

luceos avatar luceos commented on June 10, 2024

@garygreen

I really fail to understand how this can be a Flarum issue. Are you sure this isn't an opcache issue? Any changes to your files (with opcache enabled) requires an opcache flush.

from framework.

garygreen avatar garygreen commented on June 10, 2024

@luceos Your welcome to try it - try to file_get_contents of a local Laravel app running on same FastCGI host/port if you happen to have one available.

It isn't Opcache (not enabled at all for me on localhost) - it's most likely env problem. See links mentioned above - caching of configs seems to help. If Flarum doesn't use DotEnv I wonder how it sets up the environment? Is that possibly conflicting with the other Laravel apps environment variables? putenv $_ENV

I'll close this issue. At least there is some visibility for devs if they come across the problem and find the above links useful.

from framework.

luceos avatar luceos commented on June 10, 2024

What is your environment like? I see you're on Windows, do you use virtualisation @garygreen ?

PS I just tested this on my macbook using a wildcard nginx install with pretty much exactly your code to another laravel app on the same machine and it works.

from framework.

garygreen avatar garygreen commented on June 10, 2024

I am indeed on Windows with nginx. Have php-cgi.exe -b 127.0.0.1:9000 running and use nginx config setup so that both Flarum and other Laravel app use same fastcgi_pass

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

Btw thank you so much for taking a look at it. It might be a Windows specific problem. Changing FastCGI to run on different ports for Flarum and the other Laravel app fixes it (of course requires another php-cgi.exe to be listening)

from framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.