Google chrome downloading my php file, not rendering it - php

I have noted that this question has been asked before, but none of the solutions offered have fixed my problem.
I have MAMP PRO. I sat down to work and when I typed my localhost URL into chrome, it just downloads the file rather than opens it in the browser. Others have suggested this is caching problem, but I have cleared the chrome cache. I have stopped and restarted apache and MySQL with no effect.
In addition to this (and possibly related), my databases have reverted to a version from a week ago.
Any advice on this problem, bearing in mind that clearing the cache had no effect, would be helpful...
EDIT:
So after playing around....a test.php file runs fine from 127.0.0.1/test.php but if I run.......127.0.0.1/breathe/index.php (which is my site) no joy, it just downloads it. If I shift all my directory straight into htdocs it works....
This is not ideal....but will do for now. But I want to know why this is happening. I need to understand this...so I can deal with further issues.

Related

Strange Server-Side Caching issue with Local Development Setup

I've been experiencing an odd issue where something is getting cached somewhere and I'm not sure which item to blame and it's not only driving me nuts, but slows down my development workflow (and is VERY confusing).
The Problem: I save changes made to a PHP file and refresh my browser, however the changes do not show up.
Expected Behavior: The refreshed browser shows the updated file.
Actual Behavior: The most recent changes do not show up.
For some background, here are the possible factors that could be contributing to this problem:
Macbook Pro (16-inch, 2019, 2.6 GHz 6-Core Intel Core i7)
Mac OS (Monterey v12.5)
Chrome (v104.0.5112.79)
MAMP Pro (6.6 Build 33836), Apache (2.4.46), PHP (7.4.21), MySQL (5.7.34)
Xdebug
PhpStorm (2022.2 Build #PS-222.3345.135)
Gulp (v4.0.2) - Unlikely
BrowserSync (v2.26.14) - Unlikely
I work with WordPress although I don't think that's a factor here. Basically what is happening is I'll go to make a change to a PHP file, which could be just adding more code, fixing an error, or maybe even doing a var_dump, and when BrowserSync refreshes, the changes are not reflected, so the new code does nothing, or the error still exists, or the var_dump doesn't show up. Another example is once var_dump does work, if I go to remove that debugging line, it will still show up.
I haven't figured out a fix either, other than just repeatedly refreshing the browser or re-saving the file (sometimes after adding a few blank lines to "trick" whatever it is causing it to think the file has not been changed). This can happen with or without running Gulp/BrowserSync, but I don't want to rule this out as a potential part of the problem. It's behaving like the file has not been saved.
I sometimes will quit gulp and restart to see if that resolves the issue, although it's hard to tell if it has any effect since the problem persists for maybe 30 seconds and then I'm able to see the updated file.
This is something that has recently started to happen but doesn't happen consistently. Sometimes everything works as expected, but it's hard to tell what factors are contributing to when the issue starts happening again. Most recently it started again after I restarted PhpStorm (to apply an update).
Has anyone else experienced something like this? I'm not even sure what other information would be helpful, but would be happy to post more details if I'm missing something. Thanks!

Wordpress post/pages not publishing immediately -> missed schedule instead

I experienced strange behaviour of wordpress. Whenever I want to publish a post or page it says "Missed schedule". But I have no intention to schedule. I want to publish something directly.
Some times later (I assume when wp-cron runs) the pages gets published. But this bahaviour is immense problem for me developing the page, as the customizer crashes and is not able to update changes. Usually a "immediately" published post should be published, well, immediately. Never had this issue before on other systems. I do not need the scheduling function at all, but now I am forced to schedule anything?
Setup:
CentOS 7, PHP 7.4, Apache 2.4, MySQL (Fresh Setup of the LAMP Server) Als tried PHP 7.3/MariaDB.
Installation of latest wordpress 5.5.1 without any issues (but also tests with older versions caused the problem)
Check of Servertime vs. Wordpress timezone - everything fine here
Standard Theme adter installation, no plugins active!
Checked the rights for apache user, everything fine (755/644)
Checked the "run wp cron" plugins, but thats not solving the issue.
I assume there is some problem with wp-cron or the db but most probably my server setup is missing some dependency/configuration? (But I tried different Tutorials for installation, so must be something very basic...)
Somehow it seems like nobody every experienced this issue, as I googled for hours... Hopefully sombody with more backend experience can explain whats happening here and how to fix it.
Here is a picutre of how the workflow looks like
If you are publishing without schedule Wordpress will publish it unless something prevents it from happening.
There is a known issue where if you use localhost server may have issues with Gutenberg so for test purpose try https://wordpress.org/plugins/classic-editor/ and see if its fixing it for you. If it does its probably a problem with your server settings preventing the rest api to work or issue with wp-cron.php.
Same problem here with all installations of WP in a VPS.
No useful info on google.
Somebody has find a workarround: change Centos+plesk to Ubuntu+Plesk. This seems to work fine.
I have finally found a solution to the problem. Changing the system is not a useful option for me.
In this forum they explain the problem: here
And it brings us an explanation in the plesk forums: here
It is basically a problem in CentOS7, the UTC file is not valid and this causes problems in publishing changes in WordPress.
The problem is solved by replacing that file "/usr/share/zoneinfo/UTC" with a correct copy (I have taken it from another server with CentOS6).
And everything works correctly.
You don't even need to reboot.

Brackets live preview with php file

I discovered the editor "brackets" yesterday and tried to get it working. Now I have some trouble with the live preview, which does not seem to cooperate with php files.
I opened my folder, selected the index.php and when I clicked on live preview it requested for a base url (I am running brackets version 1.7 on windows 8.1 if this is of any relevance). I have also read some instructions about this problem here, but it all leads to the consequence that it isn't possible to actually use live preview but only local servers with php files. Does anyone perhaps have a solution for this?
Most of the instructions I read are already a little bit old so perhaps it is somehow possible now (preferably without needing a local server). I have heard so many positive things about the editor, I am actually really eager to use it.
Going with a local solution for now

The system cannot find the file specified. - error in Chrome on PHP files

I have a particularly frustrating problem. I have a hosted website which has a couple of simple PHP files. The files open up in Safari, and IE; but are giving me an error message on Chrome of "The system cannot find the file specified."
I've tried cleaning out the Chrome cache and browser history, uninstalled and reinstalled chrome and yet no luck. I called up my hosting service and they are saying that they can see it fine on their systems through Chrome.
Any ideas?
Any help would be appreciated. Thanks,
Kris
I've found a workaround. By renaming the .php to .php5, it seems to work on all the browsers. I wonder whether some file binding has been messed up on the server side.
UPDATE - I found out that it was an issue with my hosting service. They fixed something on their end and things started working find. So if you have this issue, get your provider to fix it. I had a hell of a time convincing the support folks that this could even be a problem on their end. They kept asking me to flush my browser cache.

Magento: all pages keep loading forever

The problem is when I open any Magento page in browser, including /admin, it doesn't load properly and keeps loading forever. No files where changed - yesterday it was working, today it stopped working.
Can anyone recommend how to debug it? And what might be the reason for this?
There are no any errors in logs, php works fine, we tried rebooting server.
Thank you.
there wont be any errors unless you have low server resources, or maybe you have some content from external servers that probably down right now. first quick debug - open page in chrome and inspect element, you will see what slows your page. or you can check top, no IO problems, enough RAM, no processes running with >100% CPU?
rebooting server never fixes your problems. check if you have cache enabled.
not much information here to tell you exactly whats going on.
I recently ran into this problem too. My Magneto 2 site (on Ubuntu 16.04) worked fine one day and then would continuously load the next. Cleaning the cache and deleting/rebuilding static files made it work briefly, but it would go back to not loading the pages within a few clicks... even the admin.
My fix happened to be that the disk was full. I didn't realize it until I went in command line and updated composer which kept giving me a disk full error.
I switched to the desktop on Ubuntu and ran a disk analyzer, which pinpointed exactly where all my space was being used.
gksudo baobab
I didn't have gksu installed, so I had to install it first by typing:
sudo apt install gksu
It turns out I had backups that had not been deleted. Large tar files that I no longer needed.
I hope this helps!
Edited to include which OS I am using.

Categories