Chrome taking a long time to load when I refresh the page - php

What I'm developing is when I reload the page, it's taking a long time to load all the content, but if I open it in a new tab, the same page opens quickly. Does anyone know what can it be?
What I'm developing is when I reload the page, it's taking a long time to load all the content, but if I open it in a new tab, the same page opens quickly. Does anyone know what can it be?

Try clear out your cache
or
try this running this command php artisan optimize:clear

Related

PHP function as batch?

We're currently working with a free warehouse management system. This exports our store data to the external price search engine all 6 hours. We need to do this hourly due new law changes.
Here comes the riddle: You need to click on a button on the webinterface of our management system to start the export. This calls "host/admin/exportformate.php?action=export&kExportformat=30&token=1800b8e38ded2ead0f060c18fdbcbfdb". We solved the problem with losing the session with a firefox addon which reloads the index.php ever 30 secs.
Now when I open up a new window or tab with the URL above, everything runs fine. When I try to open the URL with a batch file to set up a cron job for the hourly export, the opened window/tab only refers to "/admin/exportformate.php?action=export", drops the rest of the line and doesn't call the action at all.
Is there a way to call this exact php action hourly, ideally with credentials? (No, .htaccess doesn't work with our management system...)
Thanks in advance!

Open same website in a 2nd tab while 1st tab is still loading

I have PHP script that takes 60s to execute. I open it in one tab in Chrome.
I want to open the same script in a 2nd tab but it won't run until the 1st tab has finished execution. Actually, I cannot access the entire website until the script has finished execution.
On the other hand, I can open the same script/website and run it in Firefox or other browsers, though it runs on Chrome. I want to be able to run multiple instances of that script from the same browser.
Is there a server setting? How can I achieve that?
Thanks a lot!
Such behaviour is usually due to PHP session locking. While the first script is running, it locks the session and therefore the second script has to wait for it to unlock.
To fix this, close the session before starting the long process.
session_write_close();
// now run your slow code

Running PHP file without Cron Jobs?

I want to perform a task with a php file, (updating a feed) which I want to do automatically once a day. I DON'T want to have to load the file in a browser by hand. The file itself could be anything (very small and fast) but it needs to be run every day without using Cron jobs
If you're on a Windows machine, you can use a scheduled task (here are the instructions for Windows 7, but Google "run scheduled task " to find similar pages for other versions). It has much the same options as Cron, with a simple interface.
Two other possible hacks:
Have the URL for the feed itself be a PHP script that updates the feed and outputs it directly. Then you could but a cache in front of that URL so it only refreshes once a day (for instance the free level of Cloudfare).
Have the PHP script create a webpage that refreshes itself once a day, using the meta refresh tag. Then open a browser window and never close it.
If the page you have created is exposed to network, you could theoretically run a cron-job from another machine on the said network and call a curl to the page:
curl http://server/yourphp

How can I tell if a PHP install is corrupt? PHP pages display quickly, but continue to load for seconds

I'm trying to convince a guy in IT that the PHP installation he gave me is corrupt (somehow). He did an upgrade to the latest PHP and since then, PHP pages have been slow. In a weird way.
If I visit a PHP page, the page displays instantly but the activity monitor in Safari shows activity for ~5 more seconds. When I use Safari's inspector, it looks like lots of things load, then there's a huge pause, then more things load. If I load a blank PHP page that doesn't reference CSS files or anything, it still sits for ~5 seconds.
Any ideas what could be causing this? It's hard for me to Google it because "PHP page loads slow" involves lots of different scenarios.
Is there a way I could somehow pinpoint why PHP loading is longer than it was before the upgrade?
If you set up a sample page with only the following in it, do you get the same behavior? This will show that php works. From a speed / content delivery point of view, you need to then determine what is causing the slowdown. phpinfo(); should load right away and display to the browser without much delay ...
<?php phpinfo(); ?>

How do i prevent chrome from getting a 'Aw snap!' with Comet?

I am using Google Chrome for my testing because in the future the comet page will be loaded in google chrome embedded.
After about 12 hours, i guess the comet file gets too big and chrome gets the official:
How do i prevent chrome from as it seems crashing after the page has been up for that long?
Do i have to refresh the iframe?
What i tried is using the comet scripts every 2 minutes i do $('script').remove(), so i guess that removes them from the DOM, but the file is still getting bigger...
Can anyone help? ^_^
i will provide as much code as needed if asked. (js, or php)
I'd try to restart the Comet after a while. One hour, or less.
Delete the iframe you where using and appendChild() a new one.

Categories