Bug 76318

Summary: executing a php script does not update the PHP page (Using a Webserver)
Product: [Applications] kdevelop Reporter: Marco Krohn <marco.krohn>
Component: Language Support: PHPAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Marco Krohn 2004-02-28 00:08:53 UTC
Version:           3.0.90-CVS (using KDE 3.2.90 (CVS >= 20040117), compiled sources)
Compiler:          gcc version 3.3.3 20040125 (prerelease) (Debian)
OS:          Linux (i686) release 2.4.23-1-k7

I have started a new PHP project -> "simple php script". After using the "PHP Settings" (great idea!) I was instantly able to see my first PHP "hello world" after using build->run. So far so good. Then I started modifying the script a bit, used build->run again, but the page does not change. Whatever I do the PHP page where the page should be rendered shows the result from the first start. 

Workaround: closing phptest.php, opening it again via "file selector" and build->run finally shows me the new output.

BTW the PHP tab has a "close button" (like every tab) which doesn't work.
Comment 1 Jens Dagerbo 2004-02-28 02:24:03 UTC
Seems to work here. 

(You did remember to save between executions, right? The php project manager apparently doesn't auto-save when you execute, so unless you save the file, nothing will happen.)
Comment 2 Sascha Cunz 2004-02-28 02:38:26 UTC
In fact, it will rerun; but the script output might still look the same, if you do not save.
Comment 3 Marco Krohn 2004-02-28 11:18:41 UTC
I am using the source code php from new project->simple php script. All my 
modification were in the line that contains the echo "hello world". And yes, 
I saved the file before execution. The PHP page does not change. 

Using a konqueror and reloading does work. Closing the phptest.php and opening 
again followed by "run" does work.

If you don't see this bug, it might be a problem with my setup. I 
created /var/www/phptest, and linked /var/www/phptest/index.php 
-> /home/krohn/phptest/phptest.php

Then I used the following settings in the "PHP settings" dialog:

* invocation: using an existing webserver
* webserver: URL on webserver: http://localhost/phptest
    file: index.php
* Shell: php executable: /usr/bin/php4   (debian/testing)

To be on the save side I just tested that preloading of the browser doesn't 
have an effect (I did this because preloading of konqueror can cause bugs 
when dealing with bookmarks)

Comment 4 Marco Krohn 2004-02-28 14:20:54 UTC
one more addition:

as I wrote "run" doesn't work for me, but

loading the page with konqueror and after that clicking "run" again, correctly 
updates the page in kdevelop.

Comment 5 Sascha Cunz 2004-02-29 13:30:41 UTC
Still, i can only reproduce this, if i do not save the file.

BUT: I tend to run no local web server, thus i let kdevelop execute the script directly via PHP.

Can you try it with php settings -> invocation Mode -> Call PHP directly?
Comment 6 Marco Krohn 2004-02-29 13:53:00 UTC
> BUT: I tend to run no local web server, thus i let kdevelop execute the
> script directly via PHP.
>
> Can you try it with php settings -> invocation Mode -> Call PHP directly?

gotcha - now it works perfectly :-) Thanks a lot!

Not sure, though what to do with this bug report. Is it a problem with my 
debian setup that it doesn't work the other way around? As I wrote before it 
works when opening the page with konqueror and pressing reload.

Comment 7 Sascha Cunz 2004-02-29 14:12:26 UTC
Now, I could imagine several ways for this to fail.

- Maybe we're checking the wrong file for modification at some place.
- Or the webserver does not find it.
- Or the webserver thinks it didn't change
- Or something might be wrong with your symlink.
- Or even any kind of setup problem.

I'll take the time and install a webserver this evening, let's see what will happen :-)
Comment 8 Sascha Cunz 2004-02-29 16:00:44 UTC
Hi Marco,
i just managed to get my apache2 and php working on my notebook. Same problem with updating, if i use a symlink. Further testing: it even appears, if i directly open a file from the htdocs dir inside kdevelop.
So, i'm not yet really sure, if it's a problem on the web server side or on kdevelops side...
But at least i can now confirm that this is infact a bug at some side and not a configuration problem
Comment 9 Marco Krohn 2004-03-01 02:22:58 UTC
Thanks for taking the time looking into this. I just tested that the symlink 
has no influence on the result. At least editing the file directly 
in /var/www/phptest.php had no effect.

If it would be a webserver bug I would expect that konqueror shows me the old 
page too. But konqi "http://localhost/phptest/index.php" always shows the 
correct page after pressing reload which makes a bug on the webserver side 
unlikely for me. 

Also closing the source file and opening it again leads to the right result 
after "run". At least this isn't the behavior I would expect if it's a 
webserver bug.

On the other hand I know very little about webservers therefore better don't 
take the above arguments too seriously. Thanks again for your help and your 
work for kdevelop!

Comment 10 Sascha Cunz 2004-03-04 03:59:13 UTC
CVS commit by cunz: 

Fixed bug #76318
  - Force KHTMLPart to reload the page, even if it is the same as before
CCMAIL: 76318-done@bugs.kde.org


  M +7 -0      phpsupportpart.cpp   1.56


--- kdevelop/languages/php/phpsupportpart.cpp  #1.55:1.56
@@ -33,4 +33,5 @@
 #include <kregexp.h>
 #include <kstatusbar.h>
+#include <kparts/browserextension.h>
 
 #include <kdevcore.h>
@@ -260,4 +261,10 @@ void PHPSupportPart::executeOnWebserver(
   }
   m_phpExeOutput="";
+  KParts::BrowserExtension* be = m_htmlView->browserExtension();
+  if(be){
+    KParts::URLArgs urlArgs( be->urlArgs() );
+    urlArgs.reload = true;
+    be->setURLArgs( urlArgs );
+  }
   m_htmlView->openURL(KURL(weburl + file));
   m_htmlView->show();