I am using the Codeigniter framework in a project - I have a tool which reads an array and sends out over 10,000 emails using the SwiftMailer Email framework.
One form which I have once submitted is supposed to send out each individual email, however it doesnt sent out all of them as after a period of time I get the following error:
404 Page Not FoundThe page you requested was not found. - 500.shtml
The page itself doesnt actually redirect anywhere else so cannot understand why it would be saying this - anyone have any ideas?
Thanks
It looks like you're actually ending up with a 500 error, but when CI tries to display the custom error page for a 500 error (500.shtml), it can't find it, and so throws a 404 instead. Check your logs for the cause of the 500 error.
It'll be a custom error page, probably set up on the web server itself. If it's an Apache server, check the httpd config and remove any ErrorDocument directives you don't want so you can see the actual error.
As Tom said, if this is happening after a significant delay, you're likely getting a timeout. The length of timeouts can be increased from the PHP end using set_time_limit() or the php.ini setting max_execution_time. However in general if you have a long-running task it is much better to run it in a background process than try to shoehorn it into an HTTP request.
Related
I am working on a login system using AngularJS,php, andMySQL. I am following this tutorial on creating an AngularJS user signup and login authentication using php & MySQL. When I put it on "live", I get the error message below:
Failed to load resource: the server responded with a status of 404
(Not Found) angularlogin/files/functions/session:1 Failed to load
resource:
I have checked my phpinfo for session, which is is enabled. What is wrong?
Not the definite answer (comments are too limited), but I spun up the project you linked to, I get almost the same error:
angular.min.js:77 GET .../files/functions/session 500 (Internal Server Error)
But a 500, not 404 so you probably need to give us more info. 404 (file not found) could mean you have forgotten to copy some files?
Anyway:
You can always check the server logs, I got ErrorException: mysqli::__construct(): (HY000/1049): Unknown database 'angularjs_login'. If this is your problem, you've just forgotten to create the database on the server.
During development, don't use the production angularjs (angular.min.js), instead use the non-minified version (angular.js) because you'll get much better error messages!
Open the network tab in your browser dev-tools (press F12), click the failed request (sessions) marked in red when not selected, and if your php-settings allows it, you can see the the error straight away under the preview-tab.
If you are sure you have copied all files, here is a qualified guess:
Your webserver is not configured for slim. Which requires all requests to go through the main index.php, in your case files/functions/index.php. If there is a request to say files/functions/session (which does not exist), the webserver will redirect that request to index.php which sorts the request and passes it along to the right place.
If the request does not go through index.php, then you'll get a 404-error.
Slim solves does this by using a .htaccess-file. files/functions/.htaccess. On windows it might be a hidden file, which could be a reason you've missed it.
Or, your webserver is configurated to not care about .htaccess-files, then you have to change your webserver settings.
Or, you have a webserver that doesn't use .htaccess-files at all, (like nginx) then you have to find another way to redirect those requests. I suggest you have a look at https://www.slimframework.com/docs/v3/start/web-servers.html
There is too little info for us to know for sure, but I think the above seems somewhat likely anyway.
I have one website in Yii framework.
It was working fine till few days but since few days sometimes I am getting
500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.
This error occurs when there is more data load in page.
If I am on simple page where there is no need to get more data in page then it is working fine but when I am uploading or downloading or need more time to get data then mostly I am getting this error.
I have Windows server.
Can anybody guide me how can i solve this error?
You should check the webserver and php error logs, most probably is configuration problem
memory_limit
max_execution_time
upload_max_filesize
check http://php.net/manual/en/ini.core.php
I have a J2.5site set up that uses language. Thus the urls look something like this:
https://www.mysite.com/en/
and
https://www.mysite.com/en/my-component/
and
https://www.mysite.com/en/my-component/my-alias
I have also set up a script that emails me whenever a 404 or 500 etc occurs:
Here is the result of one (of hundreds):
500 - Error: 500
Invalid controller: name='index', format=''
Call stack
Function Location
1 JSite->dispatch() /opt/host/apps/joomla/htdocs/index.php:42
2 JError::raiseError() /opt/host/apps/joomla/htdocs/includes/application.php:208
3 JError::raise() /opt/host/apps/joomla/htdocs/libraries/joomla/error/error.php:251
URL:/en/index.php
Notice the request. If I understand correctly, nothing should ever ask for /en/index.php. since by that time, it has already been interpreted by the entry index.php and therefore appends '/en/'
I am not getting any request errors in my apache logs or any other apache errors.
All that is happening is that I am being bombarded with emails stating that something tried to access http://www.mysite.com/en/index.php or https://www.mysite.com/en/my-component/index.php and thus either generated a 404 or 500 error
Is this spider (search engine bot) issues or is it a server misconfiguration?
Thanks
Jacques
I have a web app that allows the user to upload a pdf and it will then email it to us via swiftmailer. With some pdfs, the process fails.
I can verify that it crashes the php script, yet returns no php error. There's a 500 error from the server, but normally if there's a 500 error, php has a log of what the error was.
I have also verified that it crashes at the
$mailer->send($message);
line
Oddly, only some pdfs crash it, and those same pdfs work fine on the development server with identical code.
What could be causing php to crash without an error message?
After running several tests, I found that error logging was happening some of the time, but not others. I didn't figure out why that was so, however, I tried renaming the php-errors.log file so php would start with a new, fresh log file, and now errors are getting logged properly. I don't know why that worked, but I'll take it.
FYI, I've run into two things that can cause a PHP crash without an error message:
Script timeouts - A timeout may prevent an error message from being returned; in my particular case the script was waiting for an SMTP response when the timeout happened, which may have been why I didn't get a timeout message. Try changing your max_execution_time value in php.ini to 300 (5 minutes) and see if you can get an actual error message.
Folder permissions - I've encountered a case where insufficient folder permissions resulted in the script just halting without providing an error.
In the case of 2, I wrapped a try/catch clause around the line that was causing the halt, and I finally got an Exception to show up explaining about the permissions problem. That may be worth trying as a general response to silent crashes.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How to make PHP set HTTP status code to 500 automatically in case of any error condition? (including those that cannot be handled by user)
I want to configure Apache to send to the user a 500 response with a custom 500 page when a PHP script raises a fatal error.
What I have now is that it will print the error inline with the page content which is good for development but not for production.
How do I configure Apache to send the user a 500 response with a custom page?
Assuming that you don't only want to send a 500 header (which is easy), but really trigger a 500 error in Apache's system, there seems to be no trivial solution.
According to this question, it is PHP's default behaviour since PHP 5.2.4 if:
a fatal error occurs and
the document body is empty (Gordon found the changelog entry here).
I'm not sure how reliable this behaviour is long term (i.e. when PHP 6 comes up etc.). It's not a much advertised feature.
Other than that, I know of no way of provoking a 500 once the script runs. I asked something similar for 404s once. The answer provided there (redirecting to a predefined URL, and sending a 500 header) may be the best you can get - although that of course won't be logged.
I would say that
ErrorDocument 500 /some/page.php
should do the trick, or just a nice HTML page if you want to be sure that it renders properly even when strange things are preventing PHP pages to render.
In order to trigger the error page you look at this anser : How to return an HTTP 500 code on any error, no matter what
I want to do the same thing but I don't think it is possible with the current version of PHP. First, there is a bug where 500 errors return 200 status. So setting the ErrorDocument 500 in your config file will have no effect. In addition, there appears to be no way to access error information (for custom display and logging) even if it could be redirected.
Triggering an error is easy though. Just add this to a PHP file:
throw new Exception();