Variable not showing nor the php code is debug ...why? [duplicate] - php

When I start debugging the process stays there at 57% and says "waiting for XDebug session".
This is a duplicate post on StackOverFlow, but I tried all the answers, nothing worked.
It was working fine until before two days. I don't know what went wrong.

Having used Eclipse to launch xdebug sessions in Firefox for ever now, all of a sudden 23/4/2013 it would not launch xdebug using Firefox. It gave me the launch 57% and hang problem.
It was quite happy to launch xdebug sessions in IE/Chrome/Safari/Opera but not Firefox.
The only thing I changed around this time was I upgrades my java runtime to 1.7.0_21 from a previous version ( cannot remember which but I did jump more than one release so it was probably 1.7.0_19 )
I took a look at the project log file, Check your projects workspace folder for a subfolder called .metadata where there should be a .log file, there is one of these for each project so be sure you are looking at the correct one.
This is what was in mine:
!SESSION 2013-04-23 11:06:21.238
----------------------------------------------- eclipse.buildId=M20130204-1200 java.version=1.7.0_21
java.vendor=Oracle Corporation BootLoader constants: OS=win32,
ARCH=x86, WS=win32, NL=en_GB Command-line arguments: -os win32 -ws
win32 -arch x86
!ENTRY org.eclipse.ui.browser 4 0 2013-04-23 11:07:32.584 !MESSAGE
Launching C:\Program Files\Mozilla Firefox\firefox.exe has failed.
!STACK 0 java.io.IOException: Cannot run program "C:\Program":
CreateProcess error=2, The system cannot find the file specified at
java.lang.ProcessBuilder.start(Unknown Source) at
java.lang.Runtime.exec(Unknown Source) at
java.lang.Runtime.exec(Unknown Source) at
java.lang.Runtime.exec(Unknown Source) at
org.eclipse.ui.internal.browser.browsers.MozillaBrowser$BrowserThread.openBrowser(MozillaBrowser.java:94)
at
org.eclipse.ui.internal.browser.browsers.MozillaBrowser$BrowserThread.run(MozillaBrowser.java:165)
Caused by: java.io.IOException: CreateProcess error=2, The system
cannot find the file specified at java.lang.ProcessImpl.create(Native
Method) at java.lang.ProcessImpl.(Unknown Source) at
java.lang.ProcessImpl.start(Unknown Source) ... 6 more
Because I saw this line
java.io.IOException: Cannot run program "C:\Program": CreateProcess error=2,
It made me thinks that for some reason java could no longer cope with folder names with spaces in them (very strange), so I changed the eclipse preferences and used the 8.3 naming convension C:\PROGRA~1\MOZILL~1\firefox.exe
Now it launches the xdebug session again!!
This is very strange as it does not seem to have problems with
C:\Program Files\Opera\opera.exe OR
C:\Program Files\Safari\Safari.exe OR
C:\Program Files\Internet Explorer\iexplore.exe
So all I can think of is that it does not like 2 folder names with spaces in them for some obsqure reason, because it wont launch firefox from C:\Program Files\Mozilla Firefox\firefox.exe
I assume it launches IE from a similiar folder named address as it is the default browser on this system.
Anyhow, the solution for me was to change the eclipse preferences ->General -> Web Browser -> Firefox
to use the 8.3 DOS directory naming convension.
Hope this helps

riggsfolly's analysis and solution are both correct, however for some reason my eclipse would not allow me to use the DOS 8.3 naming convention. As an alternative for those who run into the same issue you can try the following:
Create a parallel folder structure but do it without spaces (eg. "C:\ProgramFiles86\MozillaFirefox\")
Download and install firefox, using the custom installation options to install to your new 'spaceless' directory
In eclipse preferences ->General -> Web Browser: Make a new entry (eg. "Firefox2") and point it at your new installation (eg. C:\ProgramFiles86\MozillaFirefox\firefox.exe").
Finishing touch - use Mozilla Sync between the two browsers so you don't have to worry about outfitting your new Firefox.

And the easiest way I used to find out the 8.3 compatible windows path of Mozilla Firefox is as below.
C:\>dir .* /x
Volume in drive C has no label.
Volume Serial Number is XXXX-XXXX
Directory of C:\
File Not Found
C:\>dir *.* /x
Volume in drive C has no label.
Volume Serial Number is XXXX-XXXX
Directory of C:\
07/14/2009 08:50 AM <DIR> PerfLogs
04/01/2013 07:32 PM <DIR> PROGRA~1 Program Files
05/14/2013 01:50 PM <DIR> PROGRA~2 Program Files (x86)
01/17/2013 01:43 PM <DIR> Users
05/12/2013 05:46 AM <DIR> Windows
C:\>cd PROGRA~2
C:\PROGRA~2>dir *.* /x
Volume in drive C has no label.
Volume Serial Number is XXXX-XXXX
Directory of C:\PROGRA~2
05/14/2013 01:50 PM <DIR> .
05/14/2013 01:50 PM <DIR> ..
05/14/2013 01:50 PM <DIR> COMMON~1 Common Files
03/05/2013 10:50 AM <DIR> Google
07/14/2009 11:07 AM <DIR> INTERN~1 Internet Explorer
04/19/2013 06:03 PM <DIR> Java
04/14/2013 10:16 PM <DIR> MOZILL~1 Mozilla Firefox
04/15/2013 10:57 AM <DIR> MOZILL~2 Mozilla Maintenance Service
C:\PROGRA~2>cd MOZILL~1
C:\PROGRA~2\MOZILL~1>

I had a similar problem. mine stayed at 72%. I solved my issue by setting
xdebug.mode = debug
in the php.ini file.
I restarted the apache server now it works fine.

In addition to RiggsFolly's life-saving solution, maybe the following is useful for anyone.
Issue 1: different path on 32 bits and 64 bits Windows 7
On 32 bits Windows 7, the path is:
C:\PROGRA~1\MOZILL~1\firefox.exe
On 64 bits Windows 7, the path is:
C:\PROGRA~2\MOZILL~1\firefox.exe
(Note the different figure behind PROGRA~ , as I figured out by Abu Sithik's post)
Issue 2: Where to set the path?
You should do the setting (as RiggsFolly had already correctly said) in:
Window > Preferences > General > Web Browser > Firefox > Edit
and NOT (as I did intuitively) in Run > Debug Configurations > Web browser > Firefox - Internal Server.
At least, as far as I tried out (but I'm a relative Eclipse novice) it seems this setting doesn't influence the path that Eclipse/xdebug/java uses to start the browser in an xdebug session.
I hope this helps anyone prevent wasting time as I did fiddling around in vain, when switching between computers running resp. 32 bits and 64 bits Windows, and having to change the path to the firefox executable, until at a certain moment by luck I got the correct ways as indicated above...

I have the same problem, but suddently works when I select de 'Default system web browser instead of Firefox directly. My default web browser is Firefox and now it starts oks.
I hope this helps.

Related

phpbb 3.1.6 generates corrupt avatars if some directory permissions are not correct

NOTE: Resolved - see answer below. Question kept for reference.
Something is causing nginx or php or phpbb (or something else) to add 1 byte to the beginning of avatar files downloaded from phpbb. This corrupts the file.
To exclude external factors like Cloudflare, I have now setup phpbb as non-https, localhost only, compression off.
The problem can be seen from the following code:
Get the file from localhost - no caching or cloudflare to interfere:
wget http://localhost/forum/download/file.php?avatar=4625_1413540046.jpg -O avatest_local.jpg
‘avatest_local.jpg’ saved [6419/6419]
Test the file
jpeginfo avatest_local.jpg
avatest_local.jpg Not a JPEG file: starts with 0x0a 0xff [ERROR]
Find the identical file (phpbb does weird things to filenames)
find /var/www/forum/images/avatars/upload -size 6419c
/var/www/forum/images/avatars/upload2a36dc33069249d6b1187fd84d7fc957_4625.jpg
Test THAT file and find it to be good
jpeginfo /var/www/forum/images/avatars/upload/2a36dc33069249d6b1187fd84d7fc957_4625.jpg
./2a36dc33069249d6b1187fd84d7fc957_4625.jpg 80 x 80 24bit JFIF N 6419
Examine the first few bytes of the original file:
xdd /var/www/forum/images/avatars/upload/2a36dc33069249d6b1187fd84d7fc957_4625.jpg
0000000: ffd8 ffe0 0010 4a46 4946 0001 0101 013a ......JFIF.....:
0000010: 013a 0000 ffed 0036 5068 6f74 6f73 686f .:.....6Photosho
0000020: 7020 332e 3000 3842 494d 0404 0000 0000 p 3.0.8BIM......
Examine the first few bytes of the downloaded file and see the extra bit:
xdd avatest_local.jpg
0000000: 0aff d8ff e000 104a 4649 4600 0101 0101 .......JFIF.....
0000010: 3a01 3a00 00ff ed00 3650 686f 746f 7368 :.:.....6Photosh
0000020: 6f70 2033 2e30 0038 4249 4d04 0400 0000 op 3.0.8BIM...
Strip the first bit back out of downloaded file to prove the point:
tail -c +2 avatest_local.jpg > avatest_fixed.jpg
jpeginfo avatest_fixed.jpg
avatest_fixed.jpg 80 x 80 24bit JFIF N 6418
May or may not be relevant, but if I use the chrome header viewer inspector, the http response headers for avatars show the following:
content-disposition inline; filename=4625.jpg
But if I use redbot, it shows:
Content-Disposition: inline; filename*=UTF-8''4625.jpg
and warns that
The Content-Disposition header doesn't have a 'filename' parameter.
However, on the official phpbb board, the content-disposition headers seem correct, although as you can see below, this doesn't seem to affect other methods of viewing the image.
Summary:
When downloading or viewing an avatar in the format /download/file.php?avatar=4625_1413540046.jpg a single byte is added to the file, making it invalid.
When viewing an image like /download/file.php?id=2871 the image is totally valid and displays OK.
All image files currently on the server are valid.
I have run php in "lint" mode and all files seem valid.
I have tried running the board as "localhost" in non-https to completely remove external factors.
I have disabled all the extensions, and even removed their files.
This board was upgraded by deleting all core files and copying the new ones over.
Nginx serves image and other files directly perfectly well, and other software on the same server runs fine.
Server details:
nginx 1.9.4
PHP 5.6.4-4ubuntu6.3
phpbb 3.1.6
Linux 3.19.0-30-generic #34-Ubuntu SMP Fri Oct 2 22:07:32 UTC 2015 i686 i686 i686 GNU/Linux
One entire day spent on this, and both myself and the phpbb forum are totally flummoxed. Only started happening since update to phpbb 3.1.6. Clearly it's a problem unique to me. Or maybe not?
Maybe you have some empty line after ?> in php file? This could be reason
SOLVED IT!
Check permissions
https://www.phpbb.com/support/docs/en/3.0/kb/article/phpbb3-chmod-permissions/
chown -R forum:forum forum/
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
cd forum
chmod 777 cache store files images/avatars/upload/
The first bit about chown -R forum:forum forum/ is something I always do after updating anyway, but the chmod is something I THOUGHT I did ages ago. I didn't touch any of those directories when I updated the board.
I wonder if 3.1.6 handles temp and cache files differently from previous versions? All I can think is that phpbb (or something) is trying to cache the response from getting the avatar (?!) and when it found it couldn't, it still send the file but with... with an extra byte?!
But that doesn't even make sense. At all. I can't figure this out at all, but all I can say is that re-doing all the permissions has fixed it.
If anyone can explain what might have happened, I'm all ears!
I had a similar problem, it turned out to be a blank line accidentally inserted at the beginning of config.php

NFS doesn't sync files if characters are modified in a file

I'm having a strange problem with my vagrant setup: changing characters in a file and saving it doesn't reflect the change in the vm. But if I add/remove some characters or add in a few blank links, everything works fine.
I have already checked if I have opcache enabled on my PHP5.5 and "php -i | grep opcache" get any result ... so I imagine it's no.
Already tested too another vagrant (1.7.2) version, same result.
My configuration is :
Windows 7 Pro
Vagrant 1.6.3 with plugin WinNFSd
VirtualBox 4.3.12
Centos6.5 Box
PHP 5.5.19
Apache 2.4.10
PhpStorm 8 (but problem is same with SublimeText 3 and Notepad++)
Here is a video of a test from me for show you the problem :
https://www.dropbox.com/s/k70fiwfw6mopjs7/2015-03-24%2020-47-07.mp4?dl=0
Two weeks I work on this problem, it will make me crazy ...
I already tried Rsync and Samba or default vagrant synch folder but it doesn't meet my needs.
I really appreciate your help guys!
The problem on sublime was atomic_save setting being true. Not sure if there is an equivalent setting for PHPStorm/Notepad++
https://github.com/mitchellh/vagrant/issues/3888

PHP command line error : Timezone database is corrupt

My date.php is -
<?php
echo date('Y');
When I execute php -f date.php on my staging machine, I get error -
PHP Fatal error: date(): Timezone database is corrupt - this should *never* happen!
in /home/staging/test/date.php on line 2
But when I execute the same on my local / dev machine it works. Although on both staging and local machines, permissions on /etc/localtime and /usr/share/zoneinfo/ are the same.
But output of file /etc/localtime vary on both machines.
Local (php5.3.5) :
/etc/localtime: timezone data, version 2, 4 gmt time flags, 4 std time flags, no leap seconds, 4 transition times, 4 abbreviation chars
Staging (php5.3.10) :
/etc/localtime: timezone data, version 2, 1 gmt time flag, 1 std time flag, no leap seconds, no transition times, 1 abbreviation char
While trying to find what the issue is I found this link from SO. I am confused over the accepted answer. My apache user is not executing the script.
What seems to be the problem? How do I resolve this issue?
For various reasons, PHP ships with its own timezone database - it is possible to use the system TZDB by configuring the software differently at compile time.
The PHP timezonedb is implemented as C code (lots of defines) - hence you need to recompile PHP to get it working.
If your PHP interpreter is not explicitly configured to use the OS timezoneDB, then you really need to investigate why the executable is corrupt.
Please check permission of your timezone files.It might have changed when you have install some rpms.
change the permission to 655
Also check following files:
/usr
/lib
/share
/etc
My problem was that I was running php-fpm in chroot mode. I changed it to run without a chroot, and then the error went away.

netbeans php remote server upload files

I'm a student, new to netBean php remote server. I was trying to upload php files to remote server through netbeans (on run). I'm sure everything in run configuration, ftp information is correct, I have rights to upload file to that folder.
And this error occur:
Message prompt:
"Cannot logout from server *name. Reason 250 OK. Current directory: *dir name"
Logs:
Log in output window:
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 17 of 500 allowed.
220-Local time is now 04:13. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
USER a4514022
331 User a4514022 OK. Password required
PASS ******
230-OK. Current restricted directory is /
230-362 files used (3%) - authorized: 10000 files
230 2476 Kbytes used (0%) - authorized: 1536000 Kb
TYPE I
200 TYPE is now 8-bit binary
CWD /public_html
250 OK. Current directory is /public_html
CWD /public_html
250 OK. Current directory is /public_html
Summary
Failed:
file test.php Cannot upload file test.php (unknown reason).
Runtime: 408 ms, transfered: 0 file(s), 0 KB
I don't get what happen. How to fix it?
I use netbean 6.9.1, windows 7 and java ver 7 (build 1.7.0_05) platform 1.7 Those numbers, I don't know which one is the version. I just put all those there. It seems I'm the rare one get this problem...
I Know you asked this and probably your problem has solved
but I write this for the another ones;
first check the Proxy.
Tools>Option>Proxy Settings
and then set on the "no proxy" .
It will probably be solved.
I had to select less secure option e.g. Encryption: Pure FTP option to get it working for GoDaddy setup.
This answer comes even later. I also had the error and ended up here in search.
My mistake was that I had the file I wanted to download in editing with another reader (outside Netbeans). In other words, the downloaded file could not be saved to local filesystem, because the opened file prevented that.

how to obtain a stack trace when WAMP server crashes?

Some times my WAMP server crashes . I get the following error.
HTTP has encountered exception and needs to close.
Unreferenced Memory.
szAppName : httpd.exe szAppVer : 2.2.11.0 szModName : php5ts.dll
szModVer : 5.3.0.0 offset : 0000c309
C:\DOCUME~1\blrcom\LOCALS~1\Temp\WERc677.dir00\httpd.exe.mdmp
C:\DOCUME~1\blrcom\LOCALS~1\Temp\WERc677.dir00\appcompat.txt
My question is how to obtain stack trace to debug this problem ?
Should I use a windows debugger windows debugger
or is there some setting in WAMP server configuration should i enable ?
You can use Debug Diag.
Select the "Crash" rule in the "Select Rule Type" dialog that pops up when you start Debug Diag.
Also take a look at Tess Ferrandez blog entry Debugging Native memory leaks with Debug Diag 1.1. (Though it's not exactly about what you want, it's never wrong to read that blog ;-))
Debug Symbols contain information that "glue" the executable and the code together. Microsoft's format for debug symbols is called "program database" and they are usually stored in files having the extension .pdb.
Right now you only get "the assembly instruction at php5ts!zend_mm_shutdown+f69". The application called into a function zend_mm_shutdown that is exported by the php5ts.dll, so the debugger "knows" about this function regardless of whether there are debug symbols or not. But it doesn't know about the source code that led the compiler to build the machine instruction at zend_mm_shutdown+f69. The debug symbols contain such information, so a debugger can show you the source code and the context.
You can create debug symbols for both the debug and the release build (for the latter they are usually less accurate). But I haven't found a debug pack for the wamp builds of php.
For the php.net/win32 build you can download the debug packs for their release builds from http://windows.php.net/download/. Or you can download the source code and create a debug build yourself. But you can't mix the wamp executable with the php.net debug packs (i.e. you wouldn't use the the wamp executables/dlls for this).
And maybe seeing the source code can give you a hint about what's going wrong. But somehow I doubt that. The mm in zend_mm_shutdown probably stands for "memory management". It probably just releases some buckets of memory and some of its data structures are wrong at this point. That could be some other code overwriting data of the zend memory management. Could be an edge case that is handled wrong (something that has been freed but not removed from the list/data structure). The bad thing is the underlying problem could be anywhere ...far, far away from the code that is finally causing the access violation. And if zend_mm_shutdown really is some low-level memory management there's probably not much information left about what changed the data structure (and why).
I'd rather try another php build first and see if the problem occurs again. It shouldn't be to hard to replace the wamp files by the php.net build. It might be as easy as to replace the php folder in your wamp installation and then look if you have to copy some files to the apache binary folder, too.
But make a copy/backup of the complete wamp folder first ....just in case ;-)
Please see the logs below from the tool debug diagnostics tool with php 5.3.0 debug pack.
Is it problem with PDO library that is used to access MySql ??
The crash is very intermittent. Please reply.
Thread 61 - System ID 2760
Entry point msvcrt!_endthreadex+3a
Create time 3/31/2010 5:25:46 PM
Time spent in user mode 0 Days 0:0:16.593
Time spent in kernel mode 0 Days 0:0:0.453
Function Arg 1 Arg 2 Arg 3 Source
php5ts!_zend_mm_free_int+139 0288a878 00020004 008eff46
php5ts!_efree+36 0110ff48 02d18868 0090e442
php5ts!_zval_ptr_dtor+66 024ffa88 02d18770 02d18848
php5ts!zend_std_write_property+1f2 02d18848 0110ff48 02d18868
php5ts!pdo_stmt_construct+7d 02d1b968 02d18848 0110eb90
php5ts!zim_PDO_prepare+428 0110eb90 02d18848 00000000
php5ts!zend_do_fcall_common_helper_SPEC+946 024ffbf8 028894c8 024ffe74
php5ts!execute+29e 02d40070 02889400 00000000
php5ts!zend_execute_scripts+f6 00000008 028894c8 00000000
php5ts!php_execute_script+22d 024ffe74 028894c8 00000005
php5apache2_2!php_handler+5d0 03249f98 008238b8 03249f98
libhttpd!ap_run_handler+21 03249f98 03249f98 03249f98
libhttpd!ap_invoke_handler+ae 00000000 029e9fd8 024fff38
libhttpd!ap_die+29e 03249f98 00000000 00788168
libhttpd!ap_get_request_note+1c9c 029e9fd8 029e9fd8 029e9fd8
libhttpd!ap_run_process_connection+21 029e9fd8 00775050 024fff80
libhttpd!ap_process_connection+33 029e9fd8 027de3f0 00ed0000
libhttpd!ap_regkey_value_remove+c7c 029e9fd0 00ed0000 00f10000
msvcrt!_endthreadex+a9 011d3088 00ed0000 00f10000
kernel32!BaseThreadStart+37 77c3a341 011d3088 00000000

Categories