Jump to content

NotionCommotion

Members
  • Content Count

    2,177
  • Joined

  • Last visited

  • Days Won

    9

NotionCommotion last won the day on July 2 2019

NotionCommotion had the most liked content!

Community Reputation

32 Good

About NotionCommotion

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I actually have two parts to this post. One which describes just my understanding on how a multipart request should look with a REST API and gives a little context, and the second how to actually implement it using Sympony and api-platform. Part 1 Looking to simultaneously upload a file, some file meta data, and identifier of the uploading user to a REST API, and will do so using a multipart request. Based on swagger, looks like the request should look something like the following: POST /upload HTTP/1.1 Content-Length: 428 Content-Type: multipart/form-data; boundary=abcde12
  2. Try this: echo 'blablabla '.$row["sugeneruoja"]; or better yet, var_dump($row["sugeneruoja"]); Forgot why, but echoing an integer by itself sometimes isn't displayed.
  3. Thanks kicken, Not sure if I really understood this part. If I have both a composer.json and composer.lock file, composer install appears to install based on composer.lock and ignores composer.json and the composer.lock file will not be modified. But then If I immediately afterwards perform a composer update, the dependencies "might" be changed resulting in a modified composer.lock file based on the PHP version. If I perform a composer install, and don't have a composer.lock file, then composer will first give me a warning and then create a composer.lock file and install dependencies b
  4. Use case is building a plugin for an existing CMS. The CMS and plugin are normally located remotely and the CMS "installs" the plugin. The plugin is fine with PHP7.4, but when it passes a given symfony/etc object to the CMS, I get undefined method or interface violation errors. I am uncertain whether the CMS uses the composer.json files directly and not just with composer. Your docker idea might make sense. Thanks
  5. Yes, if true, it might be relevant here. If based on the given project, I need to use either PHP7.3 or PHP7.4 and either Composer 1 or Composer 2, then I need either: A composer1.phar and a composer2.phar and run them using either php (7.4) or php73. A composer 1 executable which uses PHP7.3, a composer 1 executable which uses PHP7.4, a composer 2 executable which uses PHP7.3, and a composer 2 executable which uses PHP7.4. I prefer the second approach with the executables located in /user/local/bin instead of crating around all these composer phar files. Am I missing some
  6. Guess I incorrectly thought the the composer.json file can contain logic which dictates which version of some package is installed based on the executing PHP version. Good to know it doesn't and I can remove that variable when troubleshooting why something isn't working the way I hoped. PS. https://github.com/concrete5/composer/issues/34#issuecomment-696401142 and similar statements are what maybe made me think so.
  7. Thanks requinix, I was pretty sure I sometime got quirky/different results when running as PHP7.3 or 7.4. Are you also saying that the following will make no difference? $ php composer.phar --update #php7.4 $ php73 composer.phar --update In hindsight, agree my proposed solution of executing composer-setup.php with different PHP versions probably made no sense. If executing the phar with different PHP versions does have an effect, maybe make to executables for each composer version #!/usr/bin/env php <?php /* * This file is part of Composer. * #!/usr/bin
  8. php74 is installed as my primary php, but I am also working with a different framework that can only use php73 and set up a separate pool to deal with it. Recently, my installed composer1 told me I should upgrade to composer2 and I did so, but then found that the previously mentioned other framework also doesn't work with composer2 but only composer1. When updating a package with composer, sometimes I get composer errors or even worse no composer errors but PHP errors later on where classes don't exist, and I think it relates to using the wrong version of PHP (and maybe even composer).
  9. Thanks. Will stay away from that rabbit hole for now. Agree, but can/should their be some "middle-end" which can exist between the two? For much, the usage will be the same for each given task. For instance, when adding, deleting, or configuring one of these industrial controllers, or when viewing a trend of some environmental parameter, the same group of parameters must be provided, the user experience is the same, and there is no reason the layout needs to differ. As such, the HTML and JavaScript is the same as well as most if not all of the CSS. I understand that there still ne
  10. Currently, I have custom endpoints in the C5 application which basically do two things: Make a cURL request to retrieve JSON which is converted into an array, and then uses Twig along with a specific Twig template for each endpoint which creates a portion of HTML. Define which JS/CSS resources should be included with the page. Then the HTML along with the JS/CSS resources are given to the core C5 application which renders the page as applicable. My thought was to move the functionality of creating the portion of HTML along along with the required resource paths to another
  11. Here is the scenario. I created a niche market API which provides environmental data. The data is obtained by industrial controllers which don't monitor anything by default, and the API has additional endpoints which are used to instruct the industrial controllers to start monitoring some parameter so the API can then start storing the trend data. The API primarily responds with JSON, however, a couple of endpoints support CSV data. For humans/webclients to access the data, I also created a webserver application which can be added to a Concrete5 (C5) CMS. I tried to make as many o
  12. Are you able to break you implementation into two basic applications? All your PHP/SQL script. It receives a HTTP request, calls the appropriate method to do something (CRUD) and either returns JSON or gives the PHP array to a view. Use something like https://www.slimframework.com/ to map between the request and the PHP script you execute. All your HTML, JS, CSS. If the above provides JSON, this will need to be setup to forward the request from the client to the above app, or you can set it up to be more integrated to have the above part just pass the resultant data array to th
  13. My typical approach to logging is as follows: openlog('PublicAPI', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER | LOG_PERROR); syslog(LOG_INFO, 'some info'); syslog(LOG_ERR, 'some error'); And then when debugging script, I just use the following: journalctl -f -uphp73-php-fpm -uphp-fpm -ureact_php_systemctl_service While it works okay, often I get more content shown by journalctl that I would like. Another downfall is segfaults are not displayed, and the only way I have been able to view them is by not including a systemd unit (i.e. -u) and just using journalctl -f, but then I get
  14. When I first saw your code shown below, I thought that you were providing your server credentials or something. Investigated a little and saw that technically it should be valid. That being said, normally one will POST the credentials to the server, the server will query the DB and set a session. if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { ... }
  15. If you are receiving a string such as '"Id"=>"1"'. you are likely requesting the data incorrectly. A hack fix might be to explode('=>', $yourString), but really think you should get to the root of the issue. Any chance they are passing you JSON and it has some helper to make it look more human readable?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.