Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    BlubBlub
    @FerhatCatak
    Here is an example on how to do that from our all fav quick google source: https://stackoverflow.com/a/36451787/4560817
    treggi12
    @treggi12
    thanks for the answers, I am configuring my new macbook air, I have just installed MySQL Workbench with the indicated settings ... but it does not connect and entering the command in the terminal (mysql -u v.je -p'v.je '- h 127.0.0.1 -P 3306 as reported on StackOverflow) the message is "command not found". i ran the command: 'docker ps' and the MariaDB container is "loaded". I have to enter the command: 'docker run -it sites_web_1 bash'?
    @FerhatCatak no, there are no more convenient operations to perform on the terminal ... it's just that I'm better off for some of them
    treggi12
    @treggi12
    the other configuration, the one with Vagrant, I use it on the other iMac computer since I got the book, there I installed MySQLWorkbech and it works without problems, like accessing the MariaDB server from the terminal
    Tom Butler
    @tom:r.je
    [m]
    you'll need to install mysql client to make the mysql command available (or you can run it through docker) For MySQL Workbench, enter v.je as the host, username and password.
    treggi12
    @treggi12
    @tom:r.je the parameters setup is already with these data, I put the same settings of the other computer, the error message is this: "Your connection attempt failed for user 'v.je' from your host to server at v.je:3306 :
    SSL connection error: unknown error number "
    Tom Butler
    @tom:r.je
    [m]
    MySQL is configured to use SSL by default, I don't know why it isn't working for you. Firstly, check SSL is working on the web server (just visit https://v.je after starting the environment) then check for the padlock in the corner.
    If SSL is working in the browser you can try turning it off in MySQL workbench's connection settings
    treggi12
    @treggi12
    ok, now MySQL Workbench is working, thank you so much. for the mysql client is this okay?
    Mysql client shell => https://dev.mysql.com/downloads/shell/
    Tom Butler
    @tom:r.je
    [m]
    yeah, that looks like it. You can also run it directly through docker though you'll need to bind host.iternal and run the command in interactive mode, so it's a longer command to type than just running it locally
    BlubBlub
    @FerhatCatak
    @treggi12 Always a good feeling to be of help. I join Tom on that, it looks like the mysql cli client we are talking about.
    treggi12
    @treggi12
    I can't tell you how much I appreciate all your help and explanations. thanks, Gabriele
    BlubBlub
    @FerhatCatak
    Does that mean it was the right tool and you were able to connect remotely from your home terminal? :D
    treggi12
    @treggi12
    @FerhatCatak yes, although mysql shell is slightly different from mysql client in command syntax. if you want some examples I can post them tonight ... now I'm not at home
    BlubBlub
    @FerhatCatak
    That's kinda funny I only ever chat with you guys when I'm at work haha.
    Found some infos about the differences: https://qr.ae/pGqzsg
    Seems like the shell is more powerful
    Maybe this is a bad comparison but seems like the difference between ps and htop.
    So in this way even I learned something new ty :D
    I would love to see some examples @treggi12
    treggi12
    @treggi12
    start the client=> mysqlsh --sql
    connection=> \connect --mysql v.je@v.je
    instead
    treggi12
    @treggi12
    connection => mysql -u v.je -p
    DB server commands:
    for example: show databases; instead show databases;\g
    basically, once you start the shell and enter the DB server, the commands are the same just put '\ g' at the end of the command
    treggi12
    @treggi12
    hi, I don't know what could have happened, today using the configuration with Vagrant the browser does not connect to the server ... so I entered the virtual machine and checked the status of the nginx server; reports this error: "Dec 27 22:34:08 v.je systemd [1]: nginx.service: Can't open PID file /run/nginx.pid (yet?) after start: No such file or directory".
    I looked for information, I installed the latest version of Vagrant and reloaded the vje / min box ... always error, I don't think I have made a change to the computer, so I can't understand what the error can be caused by. do you have any idea about the solution?
    I was doing some tests on the macBook, with Docker, and there were some errors in inserting the records so I switched to the iMac .. and nothing works there either ... I'm quite dejected
    also I wanted to make some changes to the classes and methods but I just have problems ... always problems .. too big for me ... sorry for the outburst.
    Tom Butler
    @tom:r.je
    [m]
    I don't know anything about macs but in theory Docker should work the same way. For vagrant you'll have to update your hosts file to point v.je to 192.168.56.2
    Otherwise, try vagrant destroy then vagrant up to recreate the machine from scratch
    treggi12
    @treggi12
    I recreated the Vagrant machine, but the problem remained. i think the problem is the nginx server not starting up regularly due to the wrong PID !? moreover the nginx server runs on a Linux virtual machine so the problem shouldn't depend on the fact that VB is installed on mac ... boh ...
    Tom Butler
    @tom:r.je
    [m]
    I'm not sure how that can happen. I just did vagrant box remove vje/min, vagrant destroy, vagrant up which will force it to recreate everything from scratch and it's working fine (though I'm on Linux, it shouldn't make any difference in a VM). Where are you seeing the PID message? systemctl status nginx?
    I'd still recommend using docker, I'm not planning to maintain the vagrant box as my toolchain for building/updating/minimizing it is broken and I don't have time to fix it.
    If I do update the vagrant box it will just be so it still works and I'll replace it with one that just runs the docker version in a vm.
    treggi12
    @treggi12

    I followed the sequence of the commands indicated ... "vagrant box remove vje / min, vagrant destroy, vagrant up" but the browser does not connect to the server ...
    then i ran: sudo systemctl status nginx ...

    this is the message on the terminal:
    ● nginx.service - A high performance web server and a reverse proxy server
    Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Active: active (running) since Wed 2021-12-29 19:27:52 GMT; 2min 53s ago
    Process: 1045 ExecReload = / usr / bin / nginx -s reload (code = exited, status = 0 / SUCCESS)
    Main PID: 409 (nginx)
    Tasks: 2 (limit: 515)
    Memory: 5.5M
    CGroup: /system.slice/nginx.service
    ├─ 409 nginx: master process / usr / bin / nginx -g pid /run/nginx.pid; error_log stderr;
    └─1046 nginx: worker process

    Dec 29 19:27:47 v.je systemd [1]: Starting A high performance web server and a reverse proxy server ...
    Dec 29 19:27:52 v.je systemd [1]: nginx.service: Can't open PID file /run/nginx.pid (yet?) After start: No such file or directory
    Dec 29 19:27:52 v.je systemd [1]: Started A high performance web server and a reverse proxy server.
    Dec 29 19:28:02 v.je systemd [1]: Reloading A high performance web server and a reverse proxy server.
    Dec 29 19:28:03 v.je nginx [1045]: 2021/12/29 19:28:03 [notice] 1045 # 1045: signal process started
    Dec 29 19:28:03 v.je systemd [1]: Reloaded A high performance web server and a reverse proxy server.

    then I found these instructions on the internet ... the first one ... "curl -I -v http://127.0.0.1/"

    terminal message:

    • Trying 127.0.0.1 ...
    • TCP_NODELAY set
    • Connected to 127.0.0.1 (127.0.0.1) port 80 (# 0)

      HEAD / HTTP / 1.1
      Host: 127.0.0.1
      User-Agent: curl / 7.62.0
      Accept: /

      <HTTP / 1.1 301 Moved Permanently
      HTTP / 1.1 301 Moved Permanently
      <Server: nginx / 1.15.6
      Server: nginx / 1.15.6
      <Date: Wed, 29 Dec 2021 19:34:45 GMT
      Dates: Wed, 29 Dec 2021 19:34:45 GMT
      <Content-Type: text / html
      Content-Type: text / html
      <Content-Length: 169
      Content-Length: 169
      <Connection: keep-alive
      Connection: keep-alive
      <Location: https://v.je/
      Location: https://v.je/

    <

    • Connection # 0 to host 127.0.0.1 left intact

    from which, it seems to me, that it manages to establish a connection (even if from the browser the connection error occurs both with "127.0.0.1", and with "v.je", and with "localhost" ...

    then the following statement ... "curl -I -v http: // localhost /"

    terminal message:

    • Trying :: 1 ...
    • TCP_NODELAY set
    • connect to :: 1 port 80 failed: Connection refused
    • Trying 127.0.0.1 ...
    • TCP_NODELAY set
    • Connected to localhost (127.0.0.1) port 80 (# 0)

      HEAD / HTTP / 1.1
      Host: localhost
      User-Agent: curl / 7.62.0
      Accept: /

      <HTTP / 1.1 301 Moved Permanently
      HTTP / 1.1 301 Moved Permanently
      <Server: nginx / 1.15.6
      Server: nginx / 1.15.6
      <Date: Wed, 29 Dec 2021 19:38:50 GMT
      Dates: Wed, 29 Dec 2021 19:38:50 GMT
      <Content-Type: text / html
      Content-Type: text / html
      <Content-Length: 169
      Content-Length: 169
      <Connection: keep-alive
      Connection: keep-alive
      <Location: https://v.je/
      Location: https://v.je/

    <

    • Connection # 0 to host localhost left intact

    and here the first problem already appears
    then the third statement ... "curl -I -v http: // serverhostname /"

    terminal message:

    • Could not resolve host: serverhostname
    • Closing connection 0
      curl: (6) Could not resolve host: serverhostname

    finally the fourth instruction ... "nslookup localhost"

    terminal message:
    -bash: nslookup: command not found

    this is what I found ... so it seems that there is a problem ... but what caused it, I don't understand it ... since at the date of December 16th (i.e. when I posted the previous messages) I was doing the tests on all 2 configurations (Vagrant and Docker) and since that date "nothing strange happened"

    i think i will try to format the disk and start from scratch ...

    thanks for your help, it's not easy to find such helpful people

    p.s .: sorry for the length of the post ... it's just to make the "picture" clearer

    Tom Butler
    @tom:r.je
    [m]
    the server looks like it's running fine. The issue is that for the vagrant box you must edit your hosts file to point to 192.168.56.2 to connect externally
    curl localhost is reporting the nginx version and redirecting to v.je as expected
    treggi12
    @treggi12

    I made the change:
    #

    / etc / hosts: static lookup table for host names

    #

    <ip-address> <hostname.domain.org> <hostname>

    192.168.56.2 localhost.localdomain localhost
    :: 1 localhost.localdomain localhost
    192.168.56.2 v.je localhost

    End of file

    no changes ... I stopped the virtual machine (vagrant halt) and restarted (vagrant up) ... checked that the changes to the file were still present ... but from the browser the server is not reachable ... I noticed, restarting the virtual machine, that the "mapped" address is still 127.0.0.1 ... here is a part of the startup screen:

    ...
    ==> default: Forwarding ports ...
    default: 80 (guest) => 8080 (host) (adapter 1)
    default: 80 (guest) => 80 (host) (adapter 1)
    default: 3306 (guest) => 3307 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
    ==> default: Running 'pre-boot' VM customizations ...
    ==> default: Booting VM ...
    ==> default: Waiting for machine to boot. This may take a few minutes ...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    ==> default: Machine booted and ready!
    ...

    maybe because to access the server I use the following instruction?
    ssh vagrant@127.0.0.1 -p 2222

    I don't know why some of the text is highlighted in bold
    Tom Butler
    @tom:r.je
    [m]
    You need to change the hosts on the host machine, not the vm
    treggi12
    @treggi12

    ok, now it works ... I would never have gotten there by myself ... thank you very much

    for a while I hope not to pester you with my problems anymore ... even if I have a couple of them (here we would like the smiling emojis ... I'm not sure if the translation is correct)

    treggi12
    @treggi12
    Tom's book is out, the seventh edition on SitePoint ... I can't wait for the Italian version to come out, bye
    Tom Butler
    @tom:r.je
    [m]
    I'll have to check with SitePoint, I haven't heard anything about an Italian translation yet, it probably depends on whether enough copies of 6th edition of the Italian version were sold to warrant a translation of the 7th.
    mauromadonia
    @mauromadonia
    Hi
    Using the Ninja framework method as in the Apogeo Php and Mysql book, how can I create an admin panel to match the website? .. Do I make two separate structures? example: folder1 contains the website, folder1 / panel contains the panel
    treggi12
    @treggi12
    @tom:r.je For the moment I wait a bit to see if the Apogeo publishing house will translate the 7th edition, if not I will evaluate to take the original version, thanks

    To use the MySQL client I found this command online:

    docker exec -it sites_mysql_1 /bin/bash
    mysql -u v.je -p

    or

    docker exec -it sites_mysql_1 mysql -u v.je -p

    treggi12
    @treggi12
    Hello,
    I'm back with my problems ... based on the example reported in the book I am applying the objects structure to my site. I think I understand, or at least I'm applying it this way, which at each DB table corresponds a controller class with the related methods. I put a method that "calculates" a reference date in one of these classes/controllers... then when I have a new class/controller I realized that that method would serve me for both classes. And here I started going into confusion... I can't use the first class method in the second... if I add the same method in the second class I create a useless repetition. I thought of moving it to EntryPoint.php, but it is part of the framework ... then I thought and tried to move it into the class where the controllers are instantiated... Ijdbroutes.php... but even if it was the right solution I can't make it work... essentially I think I need a class of "superior level", compared to controllers, where to put common methods, right?
    treggi12
    @treggi12

    The second thing is that I noticed that the same code works without problems with PHP7 (vagrant version) while Warnings appear with PHP8 (Docker version), in particular:

    "WARNING: Undefined Array Key" ID _..." in /…../DbTable.php online 245"

    these are the rows of the "save ()" method (the 245 is the first after the try instruction):
    Try {
    If ($record [$this-> primaryKey] == '') {
    $record [$this-> primaryKey] = null;
    }

    "Warning: Cannot modify header information - headers already sent by (output started at /…../DbTable.php:245) in /…../Register.php on line 88"

    this is the line 88 of the "RegisterUser()" method:
    header (‘location: /participanti/success);

    "Warning: trying to access array offset on value of type null in /...../EntryPoint.php on line 50" and the same "error" on line 55

    this is the line 50 of the "Run ()" method:
    $title = $page[‘title'];

    and 55:
    $output = $this-> loadTemplate($page[‘template']);

    "Warning: include(/...../ templates): Failed to open stream: No error information in /…../EntryPoint.php on line 28"

    "WARNING: includes(): Failed opening '/...../templates/' for inclusion (include_path='.: /usr/local/lib/php') in /…../EntryPoint.php on line 28 "

    this is the line 28 of the “loadTemplate()" method:
    include DIR. '/../../templates/'. $templateFileName;

    This happens when I insert a new user

    the last istruction has been mischaired
    include DIR . '/../../templates/' . $templateFileName;
    treggi12
    @treggi12
    Nothing the text is transformed
    superherip
    @superherip
    It is possible to post your packages directly in the project. For downloading and installation, a special php file is used called Manage.php. https://youtu.be/i8W18acIAGw