Skip to content

WxPHP for PHP 7 #155

Description

@everton3x

Is a version compatible with PHP 7 coming out? Are there plans for this?

Activity

  1. jgmdev commented on Feb 23, 2017

    @jgmdev
    Member

    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

  2. everton3x commented on Feb 23, 2017

    @everton3x
    Author

    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.

  3. davekimble2 commented on May 6, 2018

    @davekimble2

    Still outstanding 6 May 2018.
    wxPHP is effectively dead without it.

  4. jgmdev commented on May 7, 2018

    @jgmdev
    Member

    This 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.

  5. xuedi commented on May 7, 2018

    @xuedi

    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 :-)

  6. jgmdev commented on May 7, 2018

    @jgmdev
    Member

    And 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.

  7. NeoVance commented on Aug 16, 2018

    @NeoVance
  8. LordOfTheRats commented on Sep 20, 2019

    @LordOfTheRats
    Contributor

    I 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.

  9. jgmdev commented on Sep 25, 2019

    @jgmdev
    Member

    Didn'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!

  10. jgmdev commented on Sep 25, 2019

    @jgmdev
    Member

    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.

  11. added this to the PHP 7 milestone on Sep 25, 2019
  12. LordOfTheRats commented on Sep 30, 2019

    @LordOfTheRats
    Contributor

    I'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.

  13. jgmdev commented on Oct 1, 2019

    @jgmdev
    Member

    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!

  14. LordOfTheRats commented on Oct 11, 2019

    @LordOfTheRats
    Contributor

    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.

  15. 97 remaining items

  16. davekimble2 commented on Jan 14, 2020

    @davekimble2

    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 install

    We 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?

  17. davekimble2 commented on Feb 13, 2020

    @davekimble2

    Is LordOfTheRats still on the job?

  18. LordOfTheRats commented on Feb 13, 2020

    @LordOfTheRats
    Contributor
  19. LordOfTheRats commented on Feb 18, 2020

    @LordOfTheRats
    Contributor

    Finally found some time to continue debugging. I think there is still a profound memory management issue, as evident from the output of references.cpp after I extended it to include the current refcount (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=-6
    

    Yesterday, I extended wxPHPObjectReferences::RemoveReferences() to check m_references[i]->value.counted != nullptr, at least this fixed a specific issue on destruction of on of our dialogs. However, this does not help if value.counted is 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.

  20. davekimble2 commented on Feb 24, 2020

    @davekimble2

    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().

  21. LordOfTheRats commented on Mar 12, 2020

    @LordOfTheRats
    Contributor

    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.

  22. davekimble2 commented on Mar 12, 2020

    @davekimble2

    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.

  23. davekimble2 commented on Apr 3, 2020

    @davekimble2

    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.

  24. LordOfTheRats commented on Apr 14, 2020

    @LordOfTheRats
    Contributor

    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-dev
    

    and was able to compile with

    ./configure --enable-wxwidgets-debug --enable-wxwidgets-static
    make
    

    Hope that helps. Stay healthy!

  25. davekimble2 commented on Apr 15, 2020

    @davekimble2

    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.so
    

    I am completely lost at this point.

  26. LordOfTheRats commented on Apr 15, 2020

    @LordOfTheRats
    Contributor

    I think your php.ini should only have

    extension=wxwidgets.so
    

    The repo is called wxPHP, but internally the extensions name is actually php-wxwidgets, thus the file is called wxwidgets.so.

  27. davekimble2 commented on Apr 15, 2020

    @davekimble2

    OK, much thanks.

  28. davekimble2 commented on Apr 20, 2020

    @davekimble2

    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 lxterminal
    

    To 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 install
    

    Edit /etc/php/7.4/cli/php.ini (as root).
    At about line 950 insert 2 lines:

    ; for wxphp
    extension=wxwidgets
    

    Save 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.

  29. davekimble2 commented on Jun 8, 2020

    @davekimble2

    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 ?

  30. LordOfTheRats commented on Oct 2, 2020

    @LordOfTheRats
    Contributor

    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-dev
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wipWork in Progress

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions