Repository navigation
WxPHP for PHP 7 #155
Description
Activity
There was plans for this, I started working on a new code generator with this idea but haven't got time to keep working on it (https://github.com/peg-org). The fastest route would be to modify the current generator (https://github.com/wxphp/wxphp/tree/master/tools/source_maker) and make the necessary changes to generate php7 compatible code, the only issue is that code is kind of messy (the reason I started a new generator).
If anyone is willing to contribute this it would be really nice, there is a branch for the php7 work (that I started) if I recall correctly, and also there are some open issues with links that document the needed php7 changes #61
Thanks for the quick reply @jgmdev .
Unfortunately I do not have the necessary knowledge to contribute in this way with the project. It's a pity.
Still outstanding 6 May 2018.
wxPHP is effectively dead without it.Reacted by Jefferson González and John C. DescyThis is totally true, I myself would love to see this project working under latest PHP 7.x version. But I admit I don't have the discipline required to maintain this project while still working on the other things that pay the bills :( When I adopted this project I was really pumped up (fueled with adrenaline) and eager to see PHP getting used outside of the web development realm (I don't know how the heck I started working on this huge thing without first working on some small PHP extension to learn the zend engine which I dont fully know yet for doing mostly everything on a hurry). Also I had plans for some applications (got to ship one or two) and tasted how easy it is to develop applications in PHP for stuff non web-related which would take lots of time on other languages like C++ (I even got to add PHP support to wxFormBuilder which made things far easier). I still keep the hope that the project burnout will dissapear (heck, how many years I have been shamely inactive :S), and that I will learn to have more discipline, I even wrote this PHP application that automatically keeps track of all the activity been done on the computer https://github.com/jgmdev/infocus by interfacing to cli tools like wmctrl and so far I discovered that I'm spending more time outside of the computer than in it, which explains why I don't have much time lately to work on the stuff that I'm passionate about.
To end, it makes me really sad that I'm not moving this project further as it deserves to, and to dissapoint the trust of those that deposited their hopes in it :( At least I can share this for now which seems as a nice alternative https://github.com/krakjoe/ui it doesn't has all the controls that wxWidgets does but it should work for basic stuff. There is so many stuff I would love to see in PHP, like QT, SFML, Vulkan, etc... that in the end people would call me crazy and a PHP fanboy, even PHP developers who tell me to use the right tool for the job, but I'm too stubborn to give up on this ideal, If I could I would write a wrapper (PHP extension) on every useful C/C++ library.
i have faith, i wrote a high speed game server in php (ReactPHP) when people adopt php for more "not web" tasks, they will ask themselves why not also desktop/gui ... so its just a matter of time until some capable people will join the project and revive it :-)
Reacted by Jefferson González and kb4fxcAnd many people don't know about swoole C extension (https://github.com/swoole/swoole-src) which brings to PHP the functionality given to javascript by Node.js. Swoole adds features to write server applications and many other features for concurrent code. I have benchmarked swoole event based http server and it could handle millions of request on a single server. A random number generator written in both Node and PHP-Swoole was furiously faster on PHP by a magnitude of 2x-4x. Stuff like this should be part of the core.
Reacted by Srdjan MarjanovicI started porting wxPHP to PHP7 using the upgrade guide and lots of trial and error.
I think I made some progress, hitting the milestone of actually getting a dialog to pop up. There are still some issues like calling event callbacks and certainly lots of issues I haven't discovered yet, but I'm getting there.
I'd appreciate any feedback, tips, hints or testing. Hopefully we can revive wxPHP for one more round of action.
Reacted by 雪地 and Srdjan MarjanovicReacted by Jefferson González and Srdjan MarjanovicDidn't log into my e-mail for a couple of days and when I read this message it was a HUGE suprise! Getting it to compile is already a big milestone so congrats on that! I will clone your repo and test it as soon as I can.
Thanks for your effort!
Took a quick look on your branch and all the work you have done so far, would you like to have direct access to the wxphp repo? So you can commit all the changes to the php7 branch? Maybe master branch should be archived as a php5 branch and php7 be the new master branch, so it is easier to follow the changes occurring to get it working properly on PHP 7. Let me know what you think.
Reacted by 雪地 and AnrDaemonI'd be happy to push directly into the wxphp repo. Since I removed the #if/#else blocks for downwards compatibility for now, archiving the current state is definitly necessary. Once everthing is running we might be able to reintroduce them and make the code work for PHP 5 and PHP 7.
I'm out of office this week. I will continue working on the upgrade next week.
Reacted by 雪地Ok, I removed the php7 branch and made a php5 branch from old master, merged the changes from your php7 branch into master branch and sent you an invite to join the wxphp organization with access to the wxphp repo. So I guess all you need to do is to change your local git clone remote url into the one from this repository!
Reacted by 雪地Fixed the issue with event callbacks and a SEGFAULT on termination.
Now I always get exitcode 255/-1, even if I use
exit(0)in the PHP code.There are some cases in which wxWidgets actually does an
exit(-1), for instance in wxExit(), when wxTheApp is not defined. Annoyingly, gdb does not break inside wxWidgets code, so I can't see whats actually happening.I hope to make some more progress on monday.
97 remaining items
I am setting up wxphp on another machine, and using the script below, ./configure gives :
configure: error: SDL include files where not found
never heard of SDL before.sudo apt build-dep wxwidgets3.0
sudo apt install php-dev libsdl1.2-dev libwebkitgtk-3.0-dev
git clone https://github.com/wxphp/wxphp.git
cd wxphp
phpize
./configure --enable-wxwidgets-debug --enable-wxwidgets-static
make
make installWe will also need a refresh script, taking care of any old stuff hanging about.
Are you eventually going to go to wx-3.1.3?
Is LordOfTheRats still on the job?
- Hi guys, sorry to be this unresponsive. I got cought up in a project that demands my full attention. I plan to get back to wxPHP afterwards. I see most of the remaining issues myself and should be able to debug them. Am 13. Februar 2020 05:40:52 MEZ schrieb Dave Kimble <[email protected]>:…Is LordOfTheRats still on the job? -- You are receiving this because you commented. Reply to this email directly or view it on GitHub: #155 (comment)
Finally found some time to continue debugging. I think there is still a profound memory management issue, as evident from the output of
references.cppafter I extended it to include the currentrefcount(which is an uint32):Removing References Removing reference: 0, refcount=0 Removing reference: 1, refcount=151381888 Removing reference: 2, refcount=151329728 Removing References Removing reference: 0, refcount=151393456 Removing reference: 3, refcount=151393455 Removing reference: 4, refcount=151393454 Removing References Removing reference: 1, refcount=151374208 Removing References Removing References Removing References Removing reference: 0, refcount=10 Removing reference: 1, refcount=1267642032 Removing reference: 3, refcount=2 Removing References Removing reference: 0, refcount=1 Removing References Removing reference: 0, refcount=0 Removing reference: 3, refcount=-1 Removing References Removing reference: 0, refcount=-2 Removing References Removing reference: 0, refcount=-3 Removing reference: 3, refcount=-4 Removing References Removing reference: 0, refcount=-5 Removing References Removing reference: 0, refcount=-6Yesterday, I extended
wxPHPObjectReferences::RemoveReferences()to checkm_references[i]->value.counted != nullptr, at least this fixed a specific issue on destruction of on of our dialogs. However, this does not help ifvalue.countedis not null, but does not contain a valid pointer either.I'll try to setup a complete devenv on a production target to be able to run the debugger on production code. Maybe that helps.
I am having a memory problem.
My monitor for bytes sent/recieved is charted for the most recent 2 minutes,
so every second it calls refresh() where there is a new wxClientDC(), a new SetPen(red), a Drawline with 2 new wxPoint()s, a new SetPen(green) and another Drawline() with 2 more new wxPoint()s. This increases WM-Size slowly, but eventually chews up all the memory, at which point the OS crashes.When I rearrange the code to eliminate the new wxClientDC() every second, it ceases to Clear() the DC or to Drawline().
I have been going through the code and trying to debug the rendering. So far no luck. I have to admit that I am approaching the limit of my C++ (and Zend engine) expertise.
When I rearrange the code to eliminate the new wxClientDC() every second, it ceases to Clear() the DC or to Drawline().
That seems consistent with the other problems we observe, doesn't it? Everything points to a memory issue in wxDC and related classes. Probably just some stupid missing
*or&I keep overlooking or some reference that shouldn't be reused.Everything points to a memory issue in wxDC and related classes. Probably just some stupid missing * or &
Agreed, or maybe some scoping issue - instances created inside functions getting destroyed at return. I can see my VM-size going up at 0.094 MB/sec if that's any help.
I have had to re-install my OS, to ubuntu-18.04.
I re-downloaded wxWidgets-3.0.4 and re-built it OK.
I re-cloned wxphp OK.
But the re-build of stopped at end of configure with "error: gstreamer include files where not found".
I so what are "the gstreamer include files". Tried gstreamer1.0.This thread has obviously been tidied up, because there was some mistake around libwebkitgtk-dev wasn't there?
I need a clear set of instructions.I spun up a fresh Ubuntu 18.04 VM. I installed those packages:
apt-get -qy install php7.2-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev libgtk2.0-dev libgconf2-dev libsdl1.2-dev libjpeg-dev libgtk-3-dev libwebkitgtk-3.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-devand was able to compile with
./configure --enable-wxwidgets-debug --enable-wxwidgets-static makeHope that helps. Stay healthy!
Thank you. That compiles OK.
When I run my script I get a window which looks correct, but it gives this (and much more):dk@desktop:~$ php ./wxPHP/bandwidth/bandwidth.php PHP Warning: PHP Startup: Unable to load dynamic library 'wxphp' (tried: /usr/lib/php/20170718/wxphp (/usr/lib/php/20170718/wxphp: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/wxphp.so (/usr/lib/php/20170718/wxphp.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Calling php_wxBitmap_new on [no active file] at line 0 =========================================== Calling php_wxFont_new on [no active file] at line 0 =========================================== Calling php_wxFont_new on [no active file] at line 0 ==== ... (more than 100,000 lines) Calling php_wxPoint_new on /home/dk/wxPHP/bandwidth/bandwidth.php at line 109 =========================================== Invoking wxPoint::__construct =========================================== Parameters received 2 Parsing parameters with 'll' (&x1, &y1) Executing __construct((int) x1, (int) y1) =========================================== Calling php_wxPoint_new on /home/dk/wxPHP/bandwidth/bandwidth.php at line 109 =========================================== Invoking wxPoint::__construct =========================================== Parameters received 2 Parsing parameters with 'll' (&x1, &y1) Executing __construct((int) x1, (int) y1) =========================================== Invoking wxDC::DrawLine =========================================== Parameters received 2 Parsing parameters with 'OO' (&pt11, php_wxPoint_entry, &pt21, php_wxPoint_entry) Executing wxDC::DrawLine(*(wxPoint*) object_pointer1_0, *(wxPoint*) object_pointer1_1) Adding Reference on wxDC::DrawLine at call 3 with 2 argument(s) Adding Reference on wxDC::DrawLine at call 3 with 2 argument(s) Invoking wxControl::SetLabel =========================================== Parameters received 1 Parsing parameters with 's' (&label0, &label_len0) Executing wxControl::SetLabel(wxString(label0, wxConvUTF8)) Invoking virtual wxEvtHandler::onEvent/usr/lib/php/20170718/ indeed doesn't have a file "wxphp" or "wxphp.so", although it does have a file "wxwidgets.so" and other *.so
My /etc/php/7.2/cli/php.ini has:
; for wxphp extension=wxwidgets.so extension=wxphp.soI am completely lost at this point.
I think your php.ini should only have
extension=wxwidgets.soThe repo is called wxPHP, but internally the extensions name is actually php-wxwidgets, thus the file is called wxwidgets.so.
OK, much thanks.
Moving on to Ubuntu-20.04, which introduces PHP 7.4 .
20.04 generally works pretty well.
Download the mini.iso (74 MB), dated April 16 or later, boot from it.
This installs Ubuntu Server with no GUI.
To install X-server, LXDE desktop with no distro apps, and a terminal.sudo apt install xorg lxde-core lxterminalTo build wxwidgets and wxphp, using the script from this thread:
sudo apt build-dep wxwidgets3.0 sudo apt -qy install php7.4-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev libgtk2.0-dev libgconf2-dev libsdl1.2-dev libjpeg-dev libgtk-3-dev libwebkitgtk-3.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev git clone https://github.com/wxphp/wxphp.git cd wxphp phpize ./configure --enable-wxwidgets-static make sudo make installEdit /etc/php/7.4/cli/php.ini (as root).
At about line 950 insert 2 lines:; for wxphp extension=wxwidgetsSave and exit.
There seems to be an error in the first line - missing "install" ?, but with "install" it doesn't find build-dep or wxwidgets3.0 (or build-dev).
Pressing on, configure is "missing include files for libwebkit-3.0-dev".
Trying jgm's solution this thread, I editted ./wxphp/makefile line 41 replacing lwebkitgtk-3.0 with lwebkit2gtk-4.0 and repeated ./configure, but that didn't help.This really should be written up somewhere prominent, as no one can guess it.
No response in 7 weeks.
I'm on the point of declaring wxPHP dead again.
How is anybody going to use wxphp if they can't get it installed ?H,
I'm sorry that my time on this is so limited. I finally got around to compile wxPHP on Ubuntu 20.04 with PHP 7.4 myself.
After installing those dependencies I'm able to build the current master:
libxml2-dev libxslt1-dev libcurl4-openssl-dev libgtk2.0-dev libgconf2-dev libsdl1.2-dev libjpeg-dev libgtk-3-dev libwebkit2gtk-4.0-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-devReacted by 雪地
Is a version compatible with PHP 7 coming out? Are there plans for this?