How can I get program changes in PHP script to appear immediately? - php

This is probably completely obvious to somebody.
I'm using PHP on Windows 2008 Server R2 and IIS 7. FastCGI, PHP V5.3.
When I make a program change, I have to repeatedly change the file and re-save a good few times before the code recompiles and my edits are reflected. This is getting seriously annoying.
I've read about bytecode caching APC or Wincache etc. in the PHP manual, but as far as I can tell there is nothing installed.
Is there a standard bytecode cache? How do I disable it?
If not, what else could be causing this?
Thanks for your help.
P.S. IIS 7 Output caching is switched off (unticked) for both User and Kernel on this website instance.

Related

PHP script is not reacting to code changes, although opcache and jit are both disabled. What might be happening?

I have a php script that is not reacting to code changes that I make (I inserted a deliberate syntax error which is not be being picked up).
I am running php 8.1 on apache2 (on a local copy of ubuntu 22.04). The script is part of a drupal 9.4 custom module.
Running phpinfo now shows:
Opcode Caching Disabled
Optimization Disabled
SHM Cache Enabled
File Cache Disabled
JIT Disabled
Can someone shed any light on might be going on?
I have disabled opcaching and JIT (my understanding from what I read is that SHM cache is therefore irrelevant). I have checked the paths in the script and the code editor align. I have cleared drupal and browser caches (several times) and restarted php-fpm and apache2. From my research I had expected these to cure the problem.
I also rebuilt the whole thing to my retired dev server (the only difference is ubuntu 20.04) and after the first successful run of the script I observed the same behaviour when I make changes to the script.
Googling has not yielded a solution that helps me identify where the problem lies, though it points me at opcache rather than drupal.
Problem solved. Really basic - I should have spotted it earlier. I had a duplicate script in another directory in the website file system, which drupal was using in preference to the one it should have been using.
Apologies for wasting other people's time!

PHP 7.1.9 portable webserver issues

So I have a Portable Webserver program called USBWebserver,
because the original program still uses php 5.3 (I believe) I went on an adventure to upgrade it so that not only me but the rest of my class can use it.
I upgraded the Apache server build to 2.4.27
I upgraded the PHP binary to 7.1.9
The thing is... Everything functions but one thing:
For some reason MBString (Yes, just MBString) will not start up with a variable path anymore. If I set a manual path it functions it just no longer does this with a variable one.
Before people say:"Then why don't you just make it a manual path and be done with it." because it needs to stay portable and usable "out of the box" so to say.
I am quite stuck on how to fix this issue. If any info is needed, please ask and I will edit this post with the info. (Like if you need php.ini)
After a lot more messing about with it I finally found out what fixed this issue. I'll post it here so that others who might try to do this won't have this hurdle to combat.
extension_dir's path at first was "php\ext" as php.exe wasn't liking that I changed it to ext, which php.exe liked but apache...not so much.
After a long while I changed the path to extension_dir = ".\php\ext" and as if the gate of heaven opened... it functioned. Fully and completely without even one error.
So now I have a modified USBWebserver running:
PHP 7.1.9
Apache 2.4.27
PHPMyAdmin 4.0.4.2
MySQL 5.6.13
Fully portable, fully fuctional. I hope this little tid bit of info helps someone else some day and if some people want the program, ask and I will make a download link and edit it into my original post any this answer.
Have you been updating usbwebserver to newer version?
It seems that the officiel development has stopped.
I have tried to update php to version 8, but then the apache server won't start, and there is noting in the log file - its just empty.
Thanks
Jorgensen

Using PHP with Windows

I recently inherited a PHP Web Site to maintain. My knowledge is in ASP.Net and HTML. I need help getting started.
I downloaded WAMPServer. It installed ok, but it doesn't run. I try to run it and it just exits. No error message.
I am running Windows 7.
As you've seen, you probably want to consider XAMPP here http://www.apachefriends.org/en/xampp-windows.html. There is a portable version in there that I highly recommend. It requires no installation, so it just always seems to run, even when you've had trouble with other setups.
It also has the ability to set things up so they DO run as services, but I'd suggest if you're just getting started, don't clutter up your registry until you get into it a bit and figure out if you really need it installed.

Non Parsed Headers in PHP

There is an IIS bug that causes problems with headers when using a CGI program, and setting a redirect to a page that returns a http 302 (Object Moved). The result is that IIS doesn't parse the headers, so if you're trying to set cookies, it's not going to work. See the KB Article
It says the solution is to start the EXE CGI with -nph (Non parsed Headers) - but I'm not really sure if it works in PHP. I tried adding it to my php file and manually building headers, but that didn't work for me..
Has anyone had this problem? Any good workarounds?
I'm not entirely sure how you're seeing this bug in the modern era.
First, Q17..., er, I mean, KB176113 was published in 1997. The examples list IIS 2.0 as the product affected, and the article itself claims only versions 3-5 are affected. Unless you're running your site on Windows 2000, you aren't using IIS5. Both the article and a bit of time in Google suggests that this problem is entirely fixed in IIS6 and later.
Second, the bug impacts only CGI scripts. If you are using PHP with IIS, then you are either using the ISAPI DLL (and if you are, I'm so sorry), or you're using FastCGI, which despite having three letters in common, is not actually CGI. Nobody has run PHP in CGI mode on IIS since...
You aren't using IIS5, are you?
Okay, if you aren't on IIS7, you might not be running in FastCGI mode. You should totally switch to FastCGI with modern PHP versions. Microsoft spent a lot of time and effort getting PHP and FastCGI playing nicely with IIS.
Third, setting cookies mid-redirect has been buggy in every browser on every platform at one time or another. Are you sure that the cookie header isn't actually being sent? Check your browser's development tools.
Prefixing the PHP file with nph-, not -nph - solved this issue for me.
e.g. nph-test.php

Apache Changelog: 2.2.12 and 2.2.14

I have huge PHP script which I have been running on Apache 2.2.12 and I have recently upgraded to Apache 2.2.14. However, my PHP script doesn't work as it stops at a certain point all the time. I have been trying to work out what the difference is in these two Apache versions, I have looked at this CHANGELOG and have not been able to determine this.
When I look in my Apache error log, I find this before my PHP script fails to do anything else.
Parent: child process exited with status 255
The errors after this are just notices and they end after a few of these.
What changes in Apache do you think can cause this? I was reading around and I found a few people saying that newer versions of Apache on Vista (windows) can detect when a PHP script is in an infinite loop and will kill that child, is this true?
Thanks all for any input.
Update
Apologies, this is no longer relevant. I think its a PHP issue. I switched from 5.2 to 5.3 and I think its do with modules. I will be openning another question.
try this
download this
http://windows.php.net/downloads/snaps/php-5.2-win32-VC6-x86-latest.zip
then copy libmysql.dll into your php directory and restart apache
Actually it does not relate to modules, but to certain validations made by the core interpreter, which breaks many nonstrict processes in different PHP applications. Beware of updating PHP to 5.3! Mwahahahaha!

Categories