Jump to content
#FlattenTheCurve ×


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by requinix

  1. To test whether you can get a dump, try crashing PHP: $ php -r 'posix_kill(posix_getpid(), SIGSEGV);' Authentication system. That error is something you should look into. --enable-debug keeps more information in the PHP binary that makes backtraces more useful than without. You don't need it to generate a coredump or get a backtrace. What the backtrace can hopefully tell us is a general indication of where the problem happened - maybe it was within PHP, maybe it was within php-fpm, maybe it was from an extension, that sort of thing. That's at least a first step. Hopefully don't need the extra information in a debug build.
  2. You do it by calling trim(). That's really all there is to it. It is, but don't do it. You're talking about modifying $_POST in place and that's rather strongly frowned upon. trim() the value just before you need it for a query. Using the array to hold the modified values, instead of individual variables, is totally fine.
  3. PHP is going to use the default shell, but first let's see if the shell really is the source of the problem.
  4. Oh shoot, you're right. Sorry. 1. If there are any errors running the command, the shell is sending them to /dev/null and you won't see them. Don't do that. Keep the 2>&1 redirect but remove the 1>/dev/null so you can get output. 2. exec() only gives you the last line of output. Use another shell function that will give you all output.
  5. Copy and paste the command that was outputted into your terminal and see what it does.
  6. You probably need root to change core_pattern, so echo '/tmp/coredump-%e.%p' | sudo tee /proc/sys/kernel/core_pattern You need root at the moment you try to open core_pattern for writing. echo> only works if you're running as root in the shell (since the shell is what tries to open the file), and sudo echo> will only run the echo as root (which won't do anything). If you can reproduce the crash with a CLI command then that's easier. If not, get the core dump and give it to gdb.
  7. You should spend some time learning about... well, the basics. Then you should be able to see what's wrong with what you're trying and know what the correct syntax is.
  8. PHP can recommend a Save dialog by using Content-Disposition: attachment. Which you're already doing. Otherwise it's up to the browser.
  9. You cannot overwrite or delete a file from the client's computer. The user has to tell their browser that they want to overwrite, and that means a Save dialog.
  10. cron to run your script at the designated times, mail() or some emailing library to send the emails.
  11. An Access Denied message suggests they have some sort of system in place to prevent the sort of thing you're doing. Are you sure the website can't help you already? Does adding it to your favorites do anything special? Are the sales you're talking about the sort of thing that would be listed in their weekly ads?
  12. If you want each message then you need to query for each message. Not each message per recipient. The simplest solution is a query in a loop. "A query in a loop" is almost always wrong, and is always the least efficient solution, but it is quick so you can optimize later. Query for the messages. Set up a prepared statement for the recipients. For each message, run the recipient query and deal with it as you see fit.
  13. Okay, no documentation. What's the Java code on the other side of the socket?
  14. PHP should almost never segfault. Can you get a backtrace?
  15. You account for trailing slashes in the request URI only. You'll test with and without the slash, but the map only has the one version. Which is fine as long as you think about which version... Your function does not account for two important things: the request URI starting with the path (and not being only the path), and a potential query string. Slash problem aside, /shop/foo and /shop?bar will both fail to redirect.
  16. Not PHP documentation. I mean what documentation for the Java socket itself do you have? Is there a specification for sending and receiving messages?
  17. The redirect is configured for /shop/. With the trailing slash. Do you really have to do this with PHP? Setting up the redirect with the web server is almost definitely going to be better, and faster, and more efficient, and even simpler. I say this not just because your redirect function there isn't quite correct.
  18. Side note: glob() returns the path to each file according to the pattern you gave it. So all those filenames will look like /path/to/directory/foo.txt. What the client (C++) needs to know is the URL to hit on the server; if every file is in the same directory (which it sounds like it is) then you can get just the file names with basename(). Since you're working from C++, and by the way this is all something doable scriptable a shell and without the use of a compiled program, you'll want to make this all as simple as possible. The server should return just a plaintext list of filenames. You can read each line, get the filename, then download the file. <?php header("Content-Type: text/plain"); foreach (glob("/path/to/directory/*.txt") as $path) { echo basename($path), "\n"; } You still have the problem of having to send an HTTP request to the server and reading the response...
  19. I think that was ginerjm is trying to say is that this may not be the easiest thing in the world for you, but even though there are some people here who don't know stuff like jQuery very well, I know we can help you out in one way or another. I'm sure he wasn't trying to gate-keep the world of software development and say that you had to give up. Right, ginerjm? What I mean is that we don't know anything about your code short of what you can post here and tell us about. As people who have never seen it before, you automatically know more about it (as a whole) than we do. It's not exactly like we can just jump right into the middle of all this and tell you exactly what needs to happen. It's good to know it works somewhere, but if you need help getting it to work someplace it does not then it'd be more helpful if we knew more about that, right? The PHP code is simple enough so any problem is likely to be with the Javascript side. Any errors in the browser console? And the general troubleshooting questions apply: what is it supposed to be doing and what is it actually doing?
  20. So they're... uploaded? Using the site or FTP? Or are created directly on the server? I'm looking for a specific answer here because your requirement to delete the file depends partly on the files and how they get there.
  21. How are the files getting onto the server in the first place?
  22. a) If they say it works but it doesn't function then it doesn't work b) How is it broken? This isn't our code, we can't see it on the site, we don't know anything other than the few bits you've posted.
  23. What documentation do you have for using the connection?
  • 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.