500 Internal Server Error after enabling Mongodb with Drupal - php

In the settings.php you have to put in similar code as below settings.php.
I get an error in the nginx log file showing that it cannot find the path for DrupalMongoDBCache.
FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'DrupalMongoDBCache' not found in /var/www/drupal-test/includes/cache.inc
If I change the below following path to be exact, then i get a different error:
$conf['cache_backends'][] = '/var/www/drupal-test/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
$conf['session_inc'] = '/var/www/drupal-test/sites/all/modules/mongodb/mongodb_session/mongodb_session.inc';
FastCGI sent in stderr: "PHP message: PHP Fatal error: require_once(): Failed opening required '
/var/www/drupal-test/
drupal-test/sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc'
Notice it copies the same beginning path twice. why!? I need php to be able to go to the correct directory in able to not have this 500 internal error problem.
Please help =)
Copied code into settings.php:
#MongoDB
$conf['mongodb_connections'] = array(
'default' => array( // Connection name/alias
'host' => 'localhost', // Omit USER:PASS# if Mongo isn't configured to use authentication.
'db' => 'tomsadvice-mongodb' // Database name. Make something up, mongodb will automatically create the database.
),
);
include_once('.includes/cache.inc');
# -- Configure Cache
$conf['cache_backends'][] = 'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
$conf['cache_class_cache'] = 'DrupalMongoDBCache';
$conf['cache_class_cache_bootstrap'] = 'DrupalMongoDBCache';
$conf['cache_default_class'] = 'DrupalMongoDBCache';
# -- Don't touch SQL if in Cache
$conf['page_cache_without_database'] = TRUE;
$conf['page_cache_invoke_hooks'] = FALSE;
# Session Caching
$conf['session_inc'] = 'sites/all/modules/mongodb/mongodb_session/mongodb_session.inc';
$conf['cache_session'] = 'DrupalMongoDBCache';
# Field Storage
$conf['field_storage_default'] = 'mongodb_field_storage';
# Message Queue
$conf['queue_default_class'] = 'MongoDBQueue';
?>

which version do you use? is it the rc2 or dev?
If you are using the dev version, just try the rc2 version.

Related

php-fpm 7.2: $pool variable is not valid anymore?

Back in PHP5, we could do something like
/etc/php5/fpm/common.conf
user = $pool
group = $pool
...
Then I can include it in other conf files.
Example:
/etc/php5/fpm/www.conf
[www]
listen = 127.0.0.1:9001
include = /etc/php5/fpm/common.conf
However, in php7.2 I get the following error
Starting php-fpm-7.2: ERROR: [/etc/php-fpm-7.2.d/common.conf:1] unknown entry 'user'
ERROR: Unable to include /etc/php-fpm-7.2.d/common.conf from /etc/php-fpm.conf at line 1
ERROR: failed to load configuration file '/etc/php-fpm.conf'
ERROR: FPM initialization failed
The $pool variable is not valid anymore.
Any idea what is the alternative?
The bug was that I put common.conf inside conf dir.
Now I moved it under includes
[testme1]
include = /etc/php-fpm-7.2.d/includes/common.conf
And I can use $pool inside it.
My bad.

TYPO3 CMS Version 9 Installation fails due to lexer missing

The TYPO3 installation fails at the last step. The error message in the log says: PHP Fatal error: Class 'Doctrine\Common\Lexer' not found
Here is the code (in fact all the code that is present in this project):
.ddev/config.yaml
APIVersion: v0.20.0
name: v9
type: typo3
docroot: public
php_version: "7.2"
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
provider: default
composer.json
{
"name": "vendor/v9",
"require": {
"typo3/minimal": "~9.3"
}
}
public/typo3conf/AdditionalConfiguration.php
<?php
/** #ddev-generated: Automatically generated TYPO3 AdditionalConfiguration.php file.
ddev manages this file and may delete or overwrite the file unless this comment is removed.
*/
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'] = array_merge($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'], [
'dbname' => 'db',
'host' => 'db',
'password' => 'db',
'port' => '3306',
'user' => 'db',
]);
ddev start && ddev ssh then composer install and confirm with Y when ready I open http://v9.ddev.local/ and get redirected to http://v9.ddev.local/typo3/install.php
Now i have to create FIRST_INSTALL. Done. "No problems detected, continue with installation". Step 2 and 3 get skipped because database connection is already known by AdditionalConfiguration.php (generated by ddev). Set up a username and password and the Sitename. "Continue"
Now i get a blue progress bar and nothing happens. Entering ddev logs shows this error:
==> /var/log/nginx/error.log <==
2018/07/19 11:45:22 [error] 223#223: *440 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'Doctrine\Common\Lexer' not found in /var/www/html/public/typo3/sysext/core/Classes/Database/Schema/Parser/Lexer.php on line 22" while reading response header from upstream, client: REMOVED_IP_ADDRESS, server: _, request: "POST /typo3/install.php HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "v9.ddev.local", referrer: "http://v9.ddev.local/typo3/install.php"
==> /var/log/php-fpm.log <==
[19-Jul-2018 11:45:22] WARNING: [pool www] child 232 said into stderr: "NOTICE: PHP message: PHP Fatal error: Class 'Doctrine\Common\Lexer' not found in /var/www/html/public/typo3/sysext/core/Classes/Database/Schema/Parser/Lexer.php on line 22"
This is a known bug in the new 9 version:
https://forge.typo3.org/issues/85552
As mentioned in the issue, you should be able to fix it if you include lexer in your own composer.json:
composer require doctrine/lexer:^1.0
Sounds like autoload problem. Did you try ddev exec composer dump -d /var/www/html?
The 'lexer class not found' issue has been fixed in latest master already, but I'm not fully sure out of the box on how you can tell ddev to use that instead, or how you could apply the patch manually. alternatively you could probably go with an older doctrine version (the one that is in core master composer.lock should do).

php page gives 500 error but executed via ssh works

I'm missing something easy I think:
Testing a mailgun install on an EC2 Linux instance.
The following code works when I use a putty session:
php /var/www/html/[thefilebelow.php]
But fails when I go to a browser and use
http://myexample.com/[thefilebelow.php]
That gives a 500 error
[thefilebelow.php]:
# Include the Autoloader (see "Libraries" for install instructions)
require '/home/ec2-user/vendor/autoload.php';
use Mailgun\Mailgun;
# Instantiate the client.
$mgClient = new Mailgun('kxxxxxxxxxx');
$domain = "mg.myexample.com";
# Make the call to the client.
$result = $mgClient->sendMessage($domain, array(
'from' => 'bob <info#lxxxxx.com>',
'to' => 'Steve <xxxxx#gmail.com>',
'subject' => 'Hello',
'text' => 'Testing some Mailgun awesomness!'
));
ERROR LOG:
PHP Fatal error: require(): Failed op ning required '/home/ec2-user/vendor/autoload.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /var/www/html/myfilebelow.php on line 3
Just to be clear - the location of the require file is correct.
Permissions for /var/www/htmlmyfilebelow.php ec2-user:www
Permissions for /home/ec2-user/vendor/ ec2-user:www
(permissions are the same for include file and script)
So the answer is that when installing composer on an ec2 instance (and generally on other servers), be sure to navigate out of the landing directory when opening a an ec2-user session in putty, if the landing directory is your user directory.
Move up to /var/www/ or some other directory owned by the www group.

PHP Error Class 'SoapClient' not found

I was trying to install Wordpress on our server to test, but in order to do that I had to upgrade our current PHP version to 5.3. I upgraded our PHP and I am now finding that our Purolator shipping module is no longer working. According to our host support the "purolator.php" file is missing data that the new version of PHP requires. Unfortunately, I can't revert our PHP version back and our programmer is away.
This is the error message I was able to get from our website host support team:
tail /var/www/vhosts/phantomcables.com/statistics/logs/error_log -f
[Thu Jul 19 08:34:28 2012] [error] [client 70.51.168.201] PHP Fatal
error: Class 'SoapClient' not found in
/var/www/vhosts/phantomcables.com/httpdocs/shippings/purolator.php on line
49, referer: https://phantomcables.com/index.php?dispatch=checkout.cart
These are lines 40 to 72:
function createPWSSOAPClient()
{
/** Purpose : Creates a SOAP Client in Non-WSDL mode with the appropriate authentication and
* header information
**/
//Set the parameters for the Non-WSDL mode SOAP communication with your Development/Production credentials
//echo DIR_SHIPPING_FILES."estimatingservice.wsdl";
$url = "https://webservices.purolator.com/PWS/V1/Estimating/EstimatingService.asmx";
$client = new SoapClient( DIR_SHIPPING_FILES."estimatingservice.wsdl",
array (
'trace' => true,
'location' => $url,
'uri' => "http://purolator.com/pws/datatypes/v1",
'login' => PRODUCTION_KEY,
'password' => PRODUCTION_PASS
)
);
//Define the SOAP Envelope Headers
$headers[] = new SoapHeader ( 'http://purolator.com/pws/datatypes/v1', 'RequestContext',
array (
'Version' => '1.0',
'Language' => 'en',
'GroupID' => 'xxx',
'RequestReference' => 'Rating Example'
)
);
//Apply the SOAP Header to your client
$client->__setSoapHeaders($headers);
return $client;
}
Any help would be greatly appreciated.
It seems like you did not have installed the php-soap package on your server.
Type
phpinfo();
in your code and check if 'Soap Client' is 'enabled'.
If not, I don't know your distribution and package manager, but here is the code for Fedora I use:
$ yum install php-soap
I suggest to do it with your programmer back or a sys admin by your sides, you never know what could happen. A backup is also useful before any installation!
You will need to add (or remove any comment characters before)
extension=soap.so
to your php.ini file, and then restart the web server.
If you are having trouble finding your php.ini file, create a page with the following:
<?php phpinfo();
and load that file in your browser.
On some systems, this setting may not actually live in php.ini. For example, if you are using Zend Server, the setting would live in /usr/local/zend/etc/conf.d/soap.ini.
So we reverted back to an older version of PHP, and re-enabled SOAP. apparently that was the issue, not sure why that didn't work with the newer version of PHP.
Again thank you for all of your help. This is a great community.
It is already posted here
Do the following:
Locate php.ini in your apache bin folder, I.e Apache/bin/php.ini
Remove the ; from the beginning of extension=php_soap.dll
Restart your Apache server
Look up your phpinfo(); again and check if you see a similar picture to the one above
If you do, problem solved!
Enable the SOAP extension, require it in your composer.json like so:
{
"require": {
"ext-soap": "*"
}
}

Unable to Connect to ssl

I have configured the openssl with wamp (Apache server). But while I using gdata api I'm getting following error.
( ! ) Fatal error: Uncaught exception 'Zend_Http_Client_Adapter_Exception' with message ' in C:\Zend_1_11_11\library\Zend\Http\Client\Adapter\Socket.php on line 234
( ! ) Zend_Http_Client_Adapter_Exception: Unable to Connect to ssl://accounts.google.com:443. Error #10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Zend_1_11_11\library\Zend\Http\Client\Adapter\Socket.php on line 234
Somebody help me on this...
Solution only for Windows users:
Check the SSL module is enabled in php.ini:
extension=php_openssl.dll
Answer from Mikhail does not work for me as I run it in Alpine Linux and .dll is only windows extension. Do not use it outside of Windows, it only adds warnings.
Solved my problem:
I had a self-signed certificate that was unable to establish connection.
To check that it is problem you can make a request:
wget way:
// not working:
wget https://accounts.google.com:443
// working:
wget https://accounts.google.com:443 --no-check-certificate
or curl way:
// not working:
curl https://accounts.google.com:443
// working:
curl https://accounts.google.com:443 -k
To temporary solve it in my dev docker container, I have added use of curl adapter and no check for certificate to the code:
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Curl',
'curloptions' => [CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false]
);
$client = new Zend_Http_Client('https://example.com', $config);
You are behind proxy, so you can not connect directly.Try to use Zend/Http/Client/Adapter/Proxy.php instead of Zend\Http\Client\Adapter\Socket.php
If you on Ubuntu try add in your php.ini
openssl.capath=/etc/ssl/certs
For more info read this issue

Categories