MongoDB is not giving off any error when trying to run through the browser,
gives a 500 internal server error.
Things I have tried:
checking php modules to make sure its running, and it is.
checked to see if it ran internal from within the server command line
"php myfile.php" and it works
Server has a domain name using an SSL, so its https:
I have tried catching the error but that also does no good tried couple of ways with no luck.
Finally caught an error which makes no sense since the new Mongo driver is loaded, as it works when I run the file directly from console as apose to browser
'MongoDB\Driver\Manager' not found in httpdocs/vendor/mongodb/mongodb/src/Client.php on line 87
Related
Please help me, my server is crashed, for static files it's fine, but my server throws error 502 bad gateway for every php script run from browser. I created a simple test.php script, when I run this scrip from command line using php test.php it's working, but when I try to open it from my web address mydomainname(dot)com/test.php or ip_address/test.php it got 502 bad gateway.
Please help me or give me some suggestions about what to check. I'm so confused because everything looks normal here. I'm using php 7.3 and Ubuntu 16.04 by the way
PHP works because you call it directly with PHP text.php
When you try to open a page with a browser, you need a web server. Something like Apache or Nginx. You have an error because you are error on your web server configuration.
Check the log of web server to find out the problem.
I'm just beginning with Symfony 3 but I'm stuck with a built-in server issue.
I am using wamp64 v3.0.6 with PHP 7.1.9 (and PHPStorm as IDE) on Windows 7.
I ran the built-in server once and got a response from localhost:8000 correctly but then, just like [this issue][1], I get the following error message when I try to access localhost:8000 on subsequent tries :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required'C:\wamp64\www\projectname\vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
I've tried uninstalling symfony, wamp64 and PHPstorm to try to identify the problem.
After reinstalling wamp (without running the server) and symfony I've noticed the following :
When I run the built-in server for the first time and immediately access localhost:8000, it works fine. But then the server stops without my pressing CTRL-C. When I restart the server and try to access localhost:8000 I now get said error message.
I've tried creating a another project using PHP 7.0.23 with the same results : once the server crashes, I can no longer load my project.
I'm hoping someone can provide an answer as regarding this issue. I've spent the past few hours searching the web for an answer and have found none.
Thanks in advance.
Credit goes to Baig for this answer :
The source of the issue lies with the antivirus. To solve this, I've excluded the wamp directory (where symfony and my projects are also stored) from my antivirus and, voila, no more server crashes, everything works fine.
I can execute my php scrape file by typing in the address bar:
domain.com/scrape.php
However, I try to use cron job on my shared server on host gator by this command:
/usr/bin/php-cli public_html/scrape.php
I got this error message:
Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in /home4/username/public_html/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 78
I already update my php version to stable 5.6 or even 5.7 version also same error. I think that it should not be php version error because I still can execute the file from browser right ?
Also I cannot reboot server Apache because hostgator support said they cannot reboot it until the server is totally down...
Any help please ! Thank you !
I ran into this problem last week on my own server. As it turned out, my browser was looking at one installation of PHP and cron was looking at a 2nd installation of PHP. One way to check is to run a PHP script through your browser that executes phpinfo(). That will tell you what the browser is running. Have cron do the same and save the results. Compare the two and make sure they're pointing to the same installation of PHP. Don't just check versions. Check install paths and loaded modules. Cheers.
So I have a website built in php and it was working perfectly on one server, I then moved the website to a server I have on Digital Ocean and am running into several errors, they seem to be based around http request failures while using the imagick library...
I was hoping to not to have to start debugging this from a code point of view as it was already working perfectly and would prefer to change server settings.
Fatal error: Uncaught exception 'ImagickException' with message 'Imagick::__construct(): HTTP request failed! HTTP/1.1 404 Not Found .
I cannot figure out what differences there, on both server allow_url_fopen is set to on.
The php version is different, 5.520 on the original server, 5.5.9 on the new server.
The versions of imagick are the same. I am also getting some other errors using the mpdf library but I will try deal with these later (Im hoping if I can resolved the first ones these ones will also get resolved).
My question is , is there possibly any other setting on the server I should be looking out for that may be causing these php errors?
EDIT:
Just to add more information, i can get rid of some of the errors by changing the file path https://www.example.com/myimage.jpg to /var/www/example/myimage.jpg . This solves some of the errors but I would rather get the root of the issue thats causing it not to work in the first place, because I feel that its the same problem thats causing other errors.
The error code says it: 404, file not found. You are probably using the wrong URL.
Are you able to fetch https://www.example.com/myimage.jpg using a webbrowser?
On several popular linux distros, /var/www/example/myimage.jpg would be served at https://www.example.com/example/myimage.jpg instead of https://www.example.com/myimage.jpg with the default configuration.
[edit]
It just came to my attention that the URL is HTTPS, there is a possibility that the script is rejecting the server certificate. Try with regular HTTP - no point in using SSL if the file is on the same machine.
i got my app at heroku server through git, now stuff that works on my local php server keeps crashing, BUT - whereas for a crash on localhost a php engine would always give me information about the error, here i just get HTTP500.
For example - if i create empty php where all i do is divide by zero, easyphp gives me warnings\notices, while heroku server does nothing at all - empty page.
Right now the server crashes because of a DB related string( i checked), but all the feedback it gives is HTTP500 error, no details. On localhost this string works. How am i supposed to find out what's the problem? is there a way to get any feedback from heroku server?
Just use heroku logs! Apache should log the actual exception.