Stack Overflow Forums » PHP
96 FOLLOWERS
Stack Overflow is a public platform building the definitive collection of coding questions and answers. This community is a place to get all your queries solved regarding PHP, a general-purpose scripting language geared toward web development. You can also share your advice about programming in the PHP language.
Stack Overflow Forums » PHP
49m ago
I am trying to count children of a DOMNode. It appears to give wrong results when I use count vs traversing or the ->length property. As if text nodes are not counted.
Consider
<?php
$html = '<p>with <a>link</a> text</p>';
$dom = new DOMDocument();
$dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$paragraph = $dom->firstChild;
$count = 0;
foreach ($paragraph->childNodes as $childNode) {
$count++;
}
echo count($paragraph->childNodes) . "\n";
echo $paragraph->childNodes->length . "\n";
echo $count . "\n";
And the outpu ..read more
Stack Overflow Forums » PHP
49m ago
I am using ldap record on my laravel app.
I have the following in my .env file:
LDAP_LOGGING=true
LDAP_CONNECTION=default
LDAP_CONNECTIONS=default
LDAP_DEFAULT_HOSTS="ad01.company.com"
LDAP_DEFAULT_USERNAME="CN=csh_dashboard_ldap,OU=Service Accounts,DC=company,DC=com"
LDAP_DEFAULT_PASSWORD="password!"
LDAP_DEFAULT_PORT=636
LDAP_DEFAULT_BASE_DN="dc=company,dc=com"
LDAP_DEFAULT_TIMEOUT=20
LDAP_DEFAULT_SSL=true
LDAP_DEFAULT_TLS=false
LDAP_DEFAULT_SASL=false
LDAP_DEFAULT_OPT_PROTOCOL_VERSION=3
and the following in the /etc/ldap/ldap.conf
#
# LDAP Defaults
#
# See ldap.conf(5) for details
# Th ..read more
Stack Overflow Forums » PHP
49m ago
I'm new to Laminas framework and Unit testing and working with a Laminas framework project and I want to start unit testing in that application. I used laminas-test package and followed their tutorial. when I execute the vendor/bin/phpunit I'm getting the following error.
1) CompanyTest\Controller\ManageControllerTest::testDirectoryAction
Laminas\ServiceManager\Exception\ServiceNotCreatedException: Service with name "ModuleManager" could not be created. Reason: Parameter to Laminas\ModuleManager\ModuleManager's Laminas\ModuleManager\ModuleManager::setModules method must be an array or impleme ..read more
Stack Overflow Forums » PHP
49m ago
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Jose\Component\Core\AlgorithmManager;
use Jose\Component\Core\JWK;
use Jose\Component\Core\JWKSet;
use Jose\Component\Encryption\Algorithm\KeyEncryption\RSAOAEP256;
use Jose\Component\Encryption\Algorithm\ContentEncryption\A256GCM;
use Jose\Component\Encryption\Serializer\CompactSerializer;
use Jose\Component\Encryption\JWEBuilder;
$algorithmManager = new AlgorithmManager([new RSAOAEP256(), new A256GCM()]);
$jweBuilder = new JWEBuilder($algorithmManager);
$JWEserializer = new CompactSeria ..read more
Stack Overflow Forums » PHP
49m ago
Slow calls from php I'm trying to understand the problem with slow calls from PHP. The PHP application makes a call, using the REST API, to a Golang microservice 400 RPS, 7 instances of Go service, nginx as load balancer. According to the Go microservice metrics, 99% of calls are completed within 5 ms. Maximum duration of calls was 6 ms. Jaeger traces in the microservice show same. Go service just returns data from in-memory cache. However, in PHP app logs I see slow calls, lots of calls for 1 seconds, for 3 seconds. What can be reason for it, how to fix the slowness ..read more
My websites links are all showing 404 Not Found pages, likely to do with the .htaccess configuration
Stack Overflow Forums » PHP
49m ago
I'm having a bit of a head scratcher with the navigation links on my website all things horror. All are returning a 404 page not found error.
I've added some security to my site in the form of public and private folders, all my pages for navigation are in the public folder, but I don't think my .htaccess file is set up correctly and thus resulting in the 404 error.
All php files for navigation are in the public directory, and worked without issue before they were moved into separate folders, additionally, the index.php makes use of a file stored in the private directory which is required for t ..read more
Stack Overflow Forums » PHP
49m ago
We have a Java product. Now we plan to develop a PHP client for interaction with this Java product. We consider several tools including Apache Thrift, Spring Boot and gRPC. Please advise what tool is more suitable for building such kind bridge. Thanks ..read more
Stack Overflow Forums » PHP
49m ago
I am currently trying to dynamically add CC email addresses to an Elementor form's email through the WordPress functions.php file. My client wants me to only add the CC email addresses when a specific value from a drop down / select field is selected. I've managed to get it to work but now it adds those CC email addresses to both emails. (Reference: Add CC or BCC email addresses dynamically when submitting a Elementor form, through the WordPress functions.php file)
I use the Elementor Form Actions After Submit Emails in the following ways:
Email = supplied information is send to the website o ..read more
Stack Overflow Forums » PHP
2h ago
Recently we upgraded PHP at 8.1 at our company and one crucial file has stopped working.
function checkVATGR($username,$password,$AFMcalledby="",$AFMcalledfor)
{
$client = new SoapClient( "https://www1.gsis.gr/webtax2/wsgsis/RgWsPublic/RgWsPublicPort?WSDL",array('trace' => true) );
//$version = $client->rgWsPublicVersionInfo();
$authHeader = new stdClass();
$authHeader->UsernameToken->Username = "$username";
$authHeader->UsernameToken->Password = "$password";
$Headers[] = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri ..read more
Stack Overflow Forums » PHP
2h ago
I'm trying to use the PHP app Roundcube with a mail server that is configured with an SSL certificate from our private CA. I know I have to add the CA's root certificate to the trust store, but which one is used by PHP?
openssl_get_cert_locations() gives me
Array
(
[default_cert_file] => /usr/lib/ssl/cert.pem
[default_cert_file_env] => SSL_CERT_FILE
[default_cert_dir] => /usr/lib/ssl/certs
[default_cert_dir_env] => SSL_CERT_DIR
[default_private_dir] => /usr/lib/ssl/private
[default_default_cert_area] => /usr/lib/ssl
[ini_cafile] =>
[ini_ca ..read more