I am trying to look up the country associated with an external IP (not the visitor) in a PHP script. I have installed the module. When I run nginx -V, --with-geoip-module appears in the list, and I have the GeoIP.dat file in /usr/share/GeoIP/ on my server. I also have the path to the GeoIP files in my nginx.conf:
geoip_country /usr/share/GeoIP/GeoIP.dat; # the country IP database
Here's the code I am using to test:
<?php
echo geoip_country_code_by_name('69.84.125.113');
?>
This is returning the following error:
PHP message: PHP Fatal error: Call to undefined function geoip_open() in /usr/share/nginx/html/geoip.php on line 7" while reading response header from upstream, client: 69.84.125.113, server: localhost, request: "GET /geoip.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mydomain.com"
Please help, I've been struggling with this all day!!
I think you need to include it first.
include ("include/geoip.inc");
Related
I'm working on a update for a old system whose versions are PHP7.1, NGINX 1.10.1 on an old Ubuntu 14.04.4.
The apps logs were displayed like this:
2022/03/10 07:05:40 [error] 23694#23694: *89040 FastCGI sent in stderr: "PHP message: .
PHP message: ..................................................[ Developer Version ]
PHP message: .
PHP message: Started GET / (1.2.3.4:34210)
PHP message: Parameters = []
PHP message: Resource Selected: ControllerName
PHP message: Session started: [123 , (**anon**)]
PHP message: Response = {"class":"HtmlResponse","code":200}" while reading response header from upstream, client: 1.2.3.4, server: oldserver.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "4.3.2.1"
However, after upgrading to Ubuntu 20.04.4, PHP 8.0.16 and Nginx 1.18.0 all my logs are clumped together without the line breaks, like this:
2022/03/10 07:49:17 [error] 44423#44423: *1 FastCGI sent in stderr: "PHP message: .PHP message: ..................................................[ Developer Version ]PHP message: .PHP message: Started GET /url-name (1.2.3.4:58262)PHP message: Parameters = []PHP message: Resource Selected: ControllerName message: Session started: [abc123 , (**anon**)]PHP message: Response = {"class":"HtmlResponse","code":200}" while reading response header from upstream, client: 1.2.3.4, server: servername.com, request: "GET /url-name HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.0-fpm.sock:", host: "servername.com"
The logs are created on dispatch.php file like this:
$logger->error('.');
$logger->error('..................................................[ Developer Version ]');
$logger->error('.');
And the $logger class basically calls the error_log method
error_log($pf.$msg);
Does anyone know to resolve this? Help appreciated, please
Just add new line
error_log( $pf . $msg . "\n");
I'm running Magento 1.9.4 on Ubuntu 18.04, PHP 7.2 with nginx 1.14 fronting it all. The shopping site is loading and navigable. However, when I search for a term, it does not list the matches in the drop-down and shows the no results page.
I can see the following message in the nginx error logs:
2020/05/22 14:54:51 [error] 1213#1213: *270 FastCGI sent in stderr: "PHP message: PHP Warning: array_keys() expects parameter 1 to be array, null given in /var/www/example.com/lib/Elastica/Status.php on line 69
PHP message: PHP Warning: in_array() expects parameter 2 to be array, null given in /var/www/example.com/lib/Elastica/Status.php on line 81
PHP message: PHP Notice: Undefined index: version in /var/www/example.com/lib/Elastica/Client.php on line 108" while reading response header from upstream, client: 72.71.71.72, server: www.example.com, request: "GET /catalogsearch/result/?q=trouser HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com", referrer: "https://www.example.com/boutique/"
This was working prior to upgrading from Ubuntu 14.04 and PHP 7.0.
I need to find another job.
Magento is using Elastica client which in turn is pointing to AWS ElasticSearch service. I had to whitelist the host (Magento site) in the AWS ElasticSearch access policy in order for it to access the service.
I was installing a script that require ionCube loaders on a Ubuntu 16.04 with PHP5.6 and Nginx. ionCube Loaders appear to be working according to phpinfo page.
http://tutt2.com/phpinfo.php
Although majority of pages are working, I'm getting a 500 Internal Server Error on page which is supposed to redirect to a third party page. This is the page that is giving the error.
http://tutt2.com/base.php?c=7&key=c98f46504d315fb435212cc15093d045&test=true
As you can see it's not redirecting. And this is what I see on NGINX error log.
2017/08/26 04:45:26 [error] 16801#16801: *767 FastCGI sent in stderr: "PHP Fatal error: Call to undefined function replacewildcardsinredirecturl() in /home/tutt2/public_html/basecode.php on line 0" while reading response header from upstream, client: 113.59.210.222, server: tutt2.com, request: "GET /base.php?c=7&key=c98f46504d315fb435212cc15093d045&test=true HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/15023718282643.sock/socket:", host: "tutt2.com", referrer: "http://tutt2.com/direct-and-landing-campaign.php?id=7"
I'm not sure what replacewildcardsinredirecturl() is. I've looked in basecode.php but it doesn't help since it's encrypted. Hope someone can point me to right direction.
Thanks in advance.
I have a problem with Grid View in Magento ver. 1.9.3.0.
When I'm trying to change the layout from list to grid view nothing happen.
http://alcosense.co.uk/alcosense/mode/list.html and try to change to grid.
I'm using NGINX + FastCGI and in the Nginx logs I can see this (spaced for readability):
682128 FastCGI sent in stderr:
"PHP message: PHP Fatal error: Call to a member function getReviewsCount() on a non-object in
/var/www/alcosense/public_html/app/code/core/Mage/Review/Block/Helper.php on line 67"
while reading response header from upstream,
client: 109.235.151.138,
server: www.alcosense.co.uk,
request: "GET /ajax/layered-navigation/catalog/category/view/id/3/requested-url/alcosense/mode/grid.html HTTP/1.1",
upstream: "fastcgi://unix:/var/run/php-fpm-alcosense.sock:",
host: "alcosense.co.uk",
referrer: "http://alcosense.co.uk/alcosense/mode/grid.html";;;
When I put this link http://alcosense.co.uk/alcosense/mode/grid.html works but just shows just only 2 products...
I don't even know where to start to fix it.
I've just installed PHP 5.5 and I am no longer able to use MongoClient and I'm getting frustrated trying to figure out why.
This doesn't work:
$m = new MongoClient("mongodb://workplz.com");
My nginx error log shows:
2013/07/05 10:40:16 [error] 4163#0: *698 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'MongoClient' not found in /blah/test.php on line 2" while reading response header from upstream, client: 123.123.123.123, server: blah, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/freecookies.sock:", host: "blah"
I do have extension=mongo.so in my php.ini.
When I do phpinfo() it shows under Mongo Version 1.4.1
Extra info:
PHP Version 5.5.0-1ubuntu2~precise1
nginx/1.4.1
Edit
When I try to execute it from php-cli I get the same thing:
PHP Fatal error: Class 'MongoClient' not found in /blah/test.php on line 2
Double check your php.ini, you're probably using the wrong one. There are several for different ways to invoke PHP.