mod_geoip + Apache 2.2 in fcgid mode - php

Is there a way to get mod_geoip working when Apache 2.2 is running in fcgid mode?
I just installed it but get the following php error when I try a test:
Fatal error: Call to undefined function apache_note() in /var/www/abc.com/geoip/index.php on line 4

I found a way around it, when mod_geoip is installed it enables some new server variables that can be accessed directly in PHP or .htaccess

Related

OSX (El Capitan) - Homebrew Apache 2.4 + PHP-FPM + mongoDB - Service unavailable

UPDATE
I've tried using PhpMyAdmin with the same configuration and I've got the same error 503 Service Unavailable.
So it seems that it has nothing to do with the mongodb module but it's an Apache or PHP-FPM misconfiguration. In my opinion it's most probably the fcgi proxy which doesn't call php-fpm the proper way but I don't know what goes wrong.
Original question
I've been tearing my hair out for hours trying to find the a solution.
Config:
OSX (El Capitan)
homebrew Apache 2.4
php-fpm (5.5 or 7.0, I've tried both, same error!)
This works in index.php
<?php
echo phpinfo();
Php info
PHP Version 7.0.18
MongoDB extension version 1.2.8
I've tried calling a php in a subdirectory (I suspected that there is a problem with the proxy parameter) but it's working.
Conslusion so far:
apache is working
document root OK
default index OK (I've tried explicitly index.php anyway)
php-fpm is running
apache proxy to php-fpm working (see UPDATE above!)
Now the weird part
I change the contents of index.php to this:
<?php
require 'vendor/autoload.php';
$client = new MongoDB\Client("mongodb://localhost:3001");
The only composer module installed is mongodb/mongodb with composer require mongodb/mongodb
The result is simple 503 Service Unavailable
The parameter (mongodb://localhost:3001) in irrelevant I have the same error without any parameters or with intentionally bad parameters.
(But in case you're wondering I'm trying to connect to the mongodb of a local development instance of a Meter application that's the reason for port 3001. And the connection is working from external program /Robomongo/)
Currently I'm using Apache ProxyPassMatch but I've tried SetHandler method as well (see below). I've tried with php-fpm 5.5 and php-fpm 7.0 (both installed with homebrew)
Apache config:
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9007/Users/myuser/Projects/test/$1
Or
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9007"
</FilesMatch>
No error messages in Apache or php-fpm logs (even with loglevel debug) despite error logging is working (I've tried making a deliberate PHP syntax error and it generated the proper error message in php-fpm error log file)
e.g.
<?php
require 'vendor/autoload.php'; // include Composer's autoloader
$client = new MongoDB;
The error message is clearly shown so the error logging is fine
Fatal error: Uncaught Error: Class 'MongoDB' not found in
/Users/myuser/Projects/test/index.php:17 Stack trace: #0 {main} thrown in
/Users/myuser/Projects/test/index.php on line 17
I've tried connecting to a MySQL database with this code:
$mysqli = new mysqli("localhost", "user", "password", "dbname");
$res = $mysqli->query("SELECT * FROM table");
print_r($res);
It works like a charm.
Any help would be appreciated.
EDIT:
composer.json contents as requested by a comment
{
"require": {
"mongodb/mongodb": "^1.1"
}
}

Deployer - Fatal error: Call to undefined function server()

Deployer version 4.1.0
When running dep deploy test the following error is reported:
PHP Fatal error: Call to undefined function server()
server ftn is defined as follows in config file:
// Configure servers
server('test', 'test.server.com')
->user('user')
->identityFile('~/.ssh/id.pub', '~/.ssh/user', 'password')
->stage("test")
->env('deploy_path', '/var/www/project.com');
This is pretty much the standard as per the Deployer site. Has anyone else experienced this issue? If so how did you resolve it?
SOLUTION
Fixed issue by running the following cmd (Suggested in comments above by Ken)
dep init
Compared the auto-generated deploy.php file to the original. Noted that the following was omitted:
namespace Deployer;
Also noted that ->env has been replaced with ->set
I had the same problem using deployer on a Laravel 5.4 project:
I had installed deployer using composer, when removed it and worked with deployer.pharfile , everything worked fine.

Domain is currently unable to handle this request 500

[domain] is currently unable to handle this request. When I try to install IPBoard, iv'e installed IPBoard multiple times on multiple servers and never had this issue, but maybe iv'e missed something out that I ain't noticed.
I have installed LAMP
Linux - Centos 7
Apache2
MySQL
PHP - 5.4
and then I allowed 10000 // 80 // 433 for Webmin and Apache and I put a simple home.html and info.php files in the /var/www/html/ directory and both load the pages correctly.
But when I upload the files from IPBoard to /var/www/html/ via FTP (filezilla) and load the webpage I just get 'Domain is currently unable to handle this request 500' and I'm not sure why maybe config in the PHP or something ?
Any help is great thanks!
Error log:
PHP Fatal error: Call to undefined function IPS\mb_internal_encoding() in /var/www/html/init.php on line 124
line 124:
mb_internal_encoding('UTF-8');

Adding PHP 5.6.12 to Ispconfig 3 (with Apache) on Debian 7

I have standard setup for Ispconfig 3:
https://www.howtoforge.com/perfect-server-debian-wheezy-apache2-bind-dovecot-ispconfig-3
Server is up to date. Everything working fine.
I'm trying to add PHP 5.6.12 following this guide:
https://www.howtoforge.com/how-to-build-php-5.6-fpm-fastcgi-with-zend-opcache-and-apcu-for-ispconfig-3-on-debian-7-wheezy
Everything went ok until start fpm:
/etc/init.d/php-5.6.12-fpm start
Starting php-fpm [02-Sep-2015 18:16:07] ERROR: [/opt/php-5.6.12/etc/php-fpm.conf:540] value is NULL for a ZEND_INI_PARSER_ENTRY
[02-Sep-2015 18:16:07] ERROR: failed to load configuration file '/opt/php-5.6.12/etc/php-fpm.conf'
[02-Sep-2015 18:16:07] ERROR: FPM initialization failed
failed
Problem is when this line is inserted at the end of /opt/php-5.6.12/etc/php-fpm.conf:
include /opt/php-5.6.12/etc/pool.d/*.conf
If I comment this line, fpm starts, but new PHP version in ISPconfig doesn't work.
I found this solution:
serverfault.com/questions/547394/is-there-a-limit-setting-a-php-admin-value-in-php-fpm
and used this fix:
github.com/DaveRandom/php-src/commit/9ad8e89d4f080626a92fc8817ab156c09b6b266a
and compiled again with it. Same result.
Any clue? Please help.
I ran into the same problem today, you need an = just after include

PHP Extension (memcache|memcached) not showing in phpinfo() but showing in php -m and php -i?

I am getting both modules listed as installed / configured when I use:
php -m
or if I use:
php -i
but when I use:
$m = new Memcache;
// or
$m = new Memcache();
// or
$m = new Memcached();
//or
$m = new Memcached;
I get the following error:
Fatal error: Class 'Memcached' not found
I am running on a Mac - OS X (10.5.7) with default install of apache & php. Additionally, I have memcached running as a daemon on 127.0.0.1:11211 and libmemcache as required by the php-memcached library. I have restarted apache tons of times and even done a machine restart.
Does anyone know why the modules/extensions show up in the command line but not in my phpinfo()? I am literally stumped, after 3 hours of googling, I am just about ready to give up.
Also, please note, my phpinfo() outputs my ini files as follows AND they are both the exact same file:
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /private/etc/php.ini
UPDATE:
Apache is failing to load the extension.
[Fri May 14 04:22:26 2010] [warn]
Init: Session Cache is not configured
[hint: SSLSessionCache] PHP Warning:
PHP Startup: Unable to load dynamic
library
'/usr/lib/php/extensions/no-debug-non-zts-20060613/memcached.so'
- (null) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load
dynamic library
'/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so'
- (null) in Unknown on line 0
Does anyone know why or how this would happen? Both of the files referenced above DEFINITELY ARE there. Should I move this question to server fault?
Your webserver is probably using mod_php, which is a seperate bit of code from the standalone (CLI) interpreter. If they are both using the same ini file, and the memcache extension is configured in the ini file, then it sounds like for some reason, the mod_php is failing to load the extension - check your webserver error_log for startup errors.
It may be that the mod_php was compiled without memcache support (most extensions need to have a stub file linked into the php code, even though the bulk of the code is not linked until run time). Or it may be a permissions problem on the shared object file. Or your webserver may be running chroot, and unable to find the extension (which would also mean that although the ini files appear to have the same path, this is relative to different roots).
HTH
C.
because both versions use different php.ini
place your php.ini into location noted in the phpinfo() outout
I would suspect that the issue revolves around permissions. When you run php from comand line, it runs as the user invoking it. When run as an apache module, it runs as "nobody".
I would assume that the memcached.so file, or the directory it's in does not have proper permissions.
I stumpled upon this post and was having the exact same problem with an extension in my php -i but not in phpinfo(). Mine was a permissions problem because of selinux on a CentOS machine. I had to change ownership and permissions and now it is working as expected.
Set php path in environment variables as given below.
Right-click on "My Computer"
Properties
Advanced Tab > Environment Variables
Under System variables, scroll down to find "Path", select and click on Edit.
Add path to your php install on the end (make sure to precede with semi-colon ";"). Example: ";C:\php7"
Click Ok.

Categories