Questions tagged [php]
PHP is a general-purpose scripting language that is especially suited for Web development. The online manual is an excellent resource for the language syntax and has an extensive list of the built-in and extension functions. Most extensions can be found in PECL.
7,953
questions
0
votes
1
answer
69
views
Cannot access database from PHP script when called from web page
I'm running Ubuntu 22.04, nginx 1.18.0, mariadb 15.1 and PHP 8.1.2.
Here the code of my database.php:
<?php
$SERVER_APP = "localhost";
$DATABASE_APP = "mydb";
$USERNAME_APP = &...
1
vote
0
answers
29
views
How to securely replace .env file with HashiCorp Vault Secrets in PHP?
I'm looking to securely replace the use of a local .env file in my PHP script with HashiCorp Vault Secrets. Here’s how my current code loads environment variables from .env:
$envFile = __DIR__ . '/../....
1
vote
1
answer
94
views
redirect only strings without backslashes and dots in URL with htaccess
I want to use htaccess to redirect any requested path of example.com/myvar ( where
myvar is a string of [a-zA-Z0-9_] ) to router.php . which lets any URL with a backslash such as exemple.com/admin/ to ...
1
vote
0
answers
72
views
Understanding php-fpm resources config
I currently have a stack with PHP-FPM and Nginx running on ECS EC2.
After observing some metrics, I noticed that the memory and CPU usage of my stack is low.
However, when I tried reducing my tasks ...
1
vote
0
answers
26
views
PHP-FPM: Processes open but never close nor become idle
We use php-fpm for our website with significant traffic around this time of the year.
Because there are many requests we tend to encounter some slowdown and 504 errors.
Yet we have a fairly solid php-...
0
votes
0
answers
37
views
How could I setup the db2 client in the php:apache docker image?
I am trying to make an image for my PHP to connecting with the IBM db2 DB.
But I tried to make my own Dockerfile and it always failed, here's the one:
FROM php:apache
ADD /v11.5.4_linuxx64_dsdriver....
0
votes
0
answers
14
views
Apache2 not using the username set in envvars (Ubuntu)
So I set a specific user within the enviroments variables file "/etc/apache2/envvars"
export APACHE_RUN_USER=someuser
But when I run the function "echo exec('whoami');" it shows &...
0
votes
1
answer
58
views
php redis module and php compile mismatch
I am trying to install php-redis via pecl.
Running this:
php -i | grep API
gives this: PHP API => 20220829
I then run pecl install redis and I get the message:
...
running: phpize
Configuring for:
...
0
votes
0
answers
46
views
502 Bad Gateway Error from Nginx on Google GKE with PHP
I am requesting help with a current configuration issue in a Google Cloud Kubernetes environment (GKE) with PHP.
Our application is a PHP application using CodeIgniter.
It runs in Kubernetes Cluster ...
0
votes
1
answer
34
views
Ubuntu 22.04 - Calling php's dns_get_record as user www-data fails because of permission issues on a specific host
I was running into issues calling PHP's getimagesize function and managed to find that no domain name can be resolved by PHP.
If I run the following command php8.2 -r "var_dump(dns_get_record('...
-1
votes
2
answers
119
views
Apache/PHP If index.php is not specified it's downloaded
I have upgraded from SLES 15 SP5 to SLES 15 SP6.
Each SP upgrade makes problems with Apache/PHP. Now again.
The current issue is that when the index.php is not specified the file is downloaded. ...
0
votes
2
answers
122
views
Call to php mail() are not queued in postfix
I'm running CentOS7, PHP 8.0.30, postfix 2.10.1-9.el7
Sometimes emails we try to send through php mail() function are not sent and after enabling verbose logging for postfix's pickup, cleanup, qmgr, ...
1
vote
0
answers
127
views
Recommended way to handle and listen for UDP traffic on AWS server [closed]
We need to listen for traffic through UDP connection. There will be Garbage type & JSon objects received on an EC2 instance. I have configured a UDP port and enabled communication via EC2 public ...
0
votes
0
answers
80
views
nginx rewrite rules and PHP configuration for multiple Mediawikis
Can anyone help me set up nginx rewrite rules for multiple wikis?
I am running multiple Mediawiki wikis from a common installation, with a separate wiki for each language. E.g.
example.org/wiki/en/
...
0
votes
1
answer
70
views
Scaling a web application for large workload [closed]
We have SAAS-based application built in CakePHP, MySQL, one module used daily by 10,000 users.
It is hosted on dedicated CPU Linode with 4CPU 8GB-RAM. MySQL is hosted locally as of now.
Occasionally ...
-1
votes
1
answer
203
views
How to update to PHP 7.4 on Debian buster - _without_ Sury packages?
Before I can move my wikis from an old Debian 10 (Buster) server with PHP 7.3, I need to upgrade the wiki - and this demands PHP 7.4.
Various howtos describe the process to update to PHP 7.4 on buster,...
0
votes
1
answer
104
views
How to fix Apache PHP rejecting post requests which are over 40MBs
My php Laravel API when put behind apache2 (with ssl) when making a post request which is roughly 40Mbs in size, it gives a 500 internal error with following log
[Wed Jul 10 21:08:51.397912 2024] [...
0
votes
0
answers
12
views
azure devops pipeline php laravel yaml PDOException: SQLSTATE[HY000] [2002] Connection refused
PDOException: SQLSTATE[HY000] [2002] Connection refused with 15 error like ,I am already hosting my website on Azure and it is working fine. However, I need to add one CID pipeline using Azure Devops ...
0
votes
1
answer
78
views
PHP 8.3 + Pear Mail fsockopen(): Unable to connect to mail.example.com:465 (Connection refused)
I had to do a migration because the OS was done with security support. I migrated and I've had a lot of trouble sending email.
I've manually setup PHP Pear Mail:
Auth_SASL-1.2.0
Net_SMTP-1.12.1
...
0
votes
1
answer
137
views
PHP 8.2 FPM + OPcache + multiuser environment + blank page issue (Child exited with code 70)
We are facing a weird issue for months, getting a white page for all websites with multiple errors like below
[02-Jul-2024 11:36:55] WARNING: [pool site1] child 3122781 exited with code 70 after 31....
1
vote
2
answers
378
views
Apache serving raw text PHP files after update to 2.4.60
Weird issue post a version bump for Apache 2.4.59 -> 2.4.60
I've been compiling Apache for my own servers for decades now, this is not a ports/pkg/apt/whatever issue.
On a CentOS (8) server (but ...
0
votes
0
answers
31
views
Azure VM not receiving data from Externally Hosted SQL Server
I have an Azure VM that hosts a PHP web application and a MySQL server.
One of the processes required is to retrieve data from a third-party instance of MS SQL Server. To facilitate this, I have ...
0
votes
0
answers
112
views
apache mod_php vs php_fpm - huge difference in load time, but only for Wordpress website
I have a Wordpress website, it was set up as nginx proxy apache mod_php.
Load time was over 2.5 seconds, so I tried several ways to speed it up.
Finally I tried php_fpm and voila - the website loaded ...
0
votes
0
answers
35
views
reading the data via scanning the QR-code
I have to deferent domain one "knu.edu.af" two "mis.knu.edu.af". Both registered in one host but the "mis.knu.edu.af" its data is located in another server and I pointed ...
0
votes
0
answers
44
views
Browser is showing Sign in window for some URLs only
I have a PHP app on IIS 10.
Recently some pages started displaying the Sign in window asking for username and password:
What could cause that? Only Windows Authentication is Enabled with "HTTP ...
0
votes
2
answers
185
views
PHP shell_exec fails, terminal/CLI works
I have to get basic information about the operating system in PHP:
$p = shell_exec('cat /etc/*-release 2>&1');
This returns:
cat: '/etc/*-release': No such file or directory
The command runs ...
0
votes
0
answers
141
views
kex_exchange_identification: read: Connection reset by peer when deploying to Centos 9 stream
I'm using Deployer PHP v7 to deploy my project to my server into multiple folders (although this isn't specific to Deplyoer)
My server is Centos 9 Stream. I need to deploy my project into multiple ...
0
votes
0
answers
58
views
php7.4-fpm crash or not
I moved from Apache2 to PHP 7.4 FPM + Nginx, it became much better in terms of performance, but the old problem remained, the server can work fine all week, or 2-3 days. But at some point it crashes. ...
0
votes
1
answer
94
views
Nginx 404 - Nginx redirecting every page to 404 not found (nginx 404 page) for all of the sites with html status code 200
My Ubuntu web server was running production sites just normal with nginx and some PHP and python applications. Just about 2 days ago, it started redirecting to 404 Not Found Page for all the sites ...
0
votes
1
answer
126
views
PHP Unable To Write To Cache Directory
I'm getting the below error on a CentOS 9 Stream server when a request comes in from PHP. It looks like the phpFastCache module can't write to the cache directory.
2024/06/19 10:06:34 [error] 4789#...
0
votes
1
answer
246
views
After updating PHP version from 8.2.6 to 8.2.20, I get error about an invalid attribute on a PDO object
I needed to update the PHP version from 8.2.6 to 8.2.20 for the security update.
I am using IIS 10. The only thing I did was to replace the php directory at C:/php with the new version of php.
I also ...
0
votes
0
answers
140
views
PHP 8.2 FastCGI + IIS 10 recommended settings
We are currently using PHP with IIS (until we can get a Linux server)
I haven't found a single post on the internet that has some recommended settings, especially Max Instances and Instance ...
1
vote
1
answer
113
views
phpMyAdmin Login Page Error: mysqli::real_connect(): Premature end of data in XAMPP
I'm encountering an error when logging in to phpMyAdmin on my local XAMPP setup. The login page displays the following errors:
mysqli::real_connect(): Premature end of data (mysqlnd_wireprotocol.c:387)...
0
votes
0
answers
427
views
Why won't the PHP cURL module load on my Windows/Apache web server?
Not sure if this is best suited to SO or here.
I have an Apache 2.4 server running on Windows Server 2019 OS.
I have installed PHP 8.1.29 from the Apache on Windows site and everything else about PHP ...
0
votes
0
answers
173
views
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() on Debian 12.5 with Apache2
I am trying to run my server with php 8.2 but it can't connect to my MariaDB database with mysqli.
I have extension=mysqli in my php.ini
When I do php -m | grep mysqli I get this:
% php -m | grep ...
1
vote
1
answer
103
views
.htaccess to accept parameters in URL
I have a WordPress page with the following structure website.com.au/pre-registration/parameter-value/, where the parameter value was originally a GET parameter, but I was requested to make it part of ...
0
votes
1
answer
45
views
Mariadb - MySQL server has gone away after 1 second of sleep
I'm receiving errors from Mariadb. This is ok:
$db = new mysqli(...);
usleep(1000*1000); // 1 second is ok
$db->query('SELECT 1');
This is not ok:
$db = new mysqli(...);
usleep(1001*1000); // 1....
-2
votes
1
answer
80
views
Which PHP package is correct one [closed]
I'm about to install LAMP on Ubuntu 24 LTS. I see that in Ubuntu I can install PHP modules in two ways.
sudo apt install php8.3-mysql
which outputs
The following additional packages will be installed:
...
1
vote
0
answers
162
views
docker-php-ext-install recently failing in a php7.1-fpm image
Im having some issues recently .. About 3 days ago my installs just docker setup is failing each time im running it ... Its been working perfect before this, unfortauntly due to work, im unable to ...
0
votes
0
answers
128
views
Long running PHP script get terminated and other separate PHP cmd line processes as well
Env: Ubuntu 22.04.4 LTS PHP 8.1 CMD line scripts started with the & and left to run in the background
I have 3 separate PHP scripts which I started from an SSH session and are placed in the ...
0
votes
0
answers
44
views
Firefox generating two sessions in PHP
I am trying to record session ID's in Mysql database using PHP. In firefox, when I load a page, it records two different session ID's at the same time. However, in Chrome it only generates a single ...
2
votes
3
answers
351
views
Why is my Azure Database for MySQL slow at first
I created a SaaS product. I am using PHP 8.3 with a MySQL 8.0 database. Locally this is very fast! No frameworks etc are used. Production runs on Azure. I have the following setup on Azure:
Database
...
0
votes
2
answers
40
views
postfix error handling to not lose the mail
I have a website with a form. When submit the form php sends a mail to a local gateway.
php code looks like this:
$ok = @mail($emailData['to'], $emailData['subject'], $message, $emailData['headers']); ...
0
votes
1
answer
98
views
nginx proxy php, how to set the access address as a subpath for php
I have a domain name, assuming it is "example.com". The backend nginx has already proxy a tomcat. The proxy domain name is "http://www.example.com/", which will jump to the tomcat ...
0
votes
0
answers
131
views
Nginx + php-fpm "504 Gateway Time-out"
During some long operations that generate many PDF files, the CRM application goes into "504 Gateway Time-out" for ALL people that are using the CRM (remote and local people). I'm always ...
0
votes
0
answers
46
views
Outdated PHP 7 version with Google App Engine
I received the attached message for App Engine that PHP 7.4. will no longer be supported by Google from July 2024. Can someone tell me if there is a way to extend this deadline and how? Are there ...
0
votes
1
answer
134
views
Apache PHP 8 keeps getting disabled
I have an Ubuntu Linux server (20.04) running Apache2 version 2.4.41
$ apachectl -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2024-04-10T17:46:26
with PHP8 enabled in /etc/apache2/mods-...
0
votes
1
answer
87
views
PHP Opcache Full, But can't work out why
Our production server says the op cache is full and it's not adding anymore scripts to the cache. Even though the configuration / statistics should.
The config is set to the following.
[opcache.enable]...
0
votes
0
answers
50
views
Nginx config rewrite .php working but forms broke
I am having trouble with the Nginx default config for my website. My PHP website runs on a linux azure machine, which uses nginx. This is currently my config:
server {
#proxy_cache cache;
#...
0
votes
0
answers
26
views
Duplicated WP Multisite for testing environment is redirecting to production site
My goal is to have a test.example.de testing environment for my www.example.de WP Blog.
Sadly, the site is still redirecting me to the production-site.
My subdomain is registered as a CNAME with a TTL ...