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,923
questions
0
votes
0
answers
32
views
WP rest api and litespeed incompatibility
I have tried everything i could think of and searched on the on Internet for the last few days i'm spending ~10 hours per day trying to diagnose this.
the issue:
in WP Site Health i get:
The REST ...
-1
votes
1
answer
17
views
Nginx error "upstream prematurely closed FastCGI request while reading upstream" with generated file download
I just spent the whole day trying to figure out this error.
We have a PHP script that generates a file for download. After upgrading nginx (1.16 -> 1.24), this script suddenly started randomly ...
-1
votes
0
answers
18
views
Begin PHP development again [closed]
It's been years since I seriously coded PHP, but now I'm starting to feel like it again. Back then I had a linux server VM with LAMP installed on my network where I could store my code over a Samba ...
0
votes
0
answers
17
views
PHP sock linked to update-alternatives choice?
In my nginx configs, I point to PHP as /var/run/php8.3-fpm.sock.
Because there is a specific version in that path, using update-alternatives does not change the PHP version my websites use.
How do I ...
1
vote
0
answers
21
views
Server forbids access to any URL ending in .php (even nonexistent ones) with "client denied by server configuration", but identical html files are OK
I'm trying to enable some php files on an Apache 2.4 machine that has no other php content. I'm finding that any php URL (even made-up URLs for nonexistent things) results in the error "client ...
-1
votes
0
answers
31
views
DNS lookup is not happening
I have two identical servers on AWS. On one server when a form is submitted, the network timings are 7.22s. On the other server it is 2.38s.
The code is same on both the servers. The only difference I ...
0
votes
2
answers
50
views
Prevent PHP from reading own source files
For simplicity consider the following example: We have a file secret.php that runs our back end code and it includes a file custom.php somewhere a long the line. Obviously the apache-user must be able ...
0
votes
1
answer
76
views
NGINX 403 ACCESS DENIED
I have this problem in nginx, it is a Laravel application. but it is in a user's folder /home/user/projects, I already tried with 777 nginx owner of the folders but it still shows the error
FastCGI ...
0
votes
1
answer
44
views
imagick extension php loaded in command line but not load in httpd
I have installed imagick extension for php by command: pecl install imagick
After that, I restart httpd and restart php-fpm.
I checked imagick loaded in php command line but when use phpinfo() for ...
1
vote
1
answer
91
views
Apache: 500 error, PHP fails on just one specific path
I need another pair of eyes to help debug an issue. This will be a long message. I'm going to provide a lot of context because I'm not sure which details might be important.
We have two servers: dev, ...
0
votes
0
answers
42
views
Correct way for creating apparmor hats in separate file
I'm trying to re-enforce the security of my LAMP config
In my configuration, each website consists in :
One Unix account
One MySQL database accessible only from one MySQL account
One VirtualHost ...
1
vote
1
answer
154
views
What is the best way to achieve SSO for Apache 2.4 within a Windows domain? [closed]
I would like to implement an SSO authentication (without login/password prompt) on a PHP 8 intranet app, which runs under Apache 2.4 x64 for Windows. My company has an Active Directory / LDAP / ...
1
vote
0
answers
64
views
After migrating to Kubernetes, PHP kernel response times increased
There is an application written in PHP Symphony. The application is stateless, all code and statics are inside the application container. We moved it from docker to kubernetes, but after testing ...
0
votes
2
answers
138
views
How do I configure SE Linux so PHP can connect to Postgres by socket
I have a PHP application that connects to a Postgresql Database.
This works when I connect via network but I get an SELinux violation when trying to connect using the socket. I believe the contexts ...
0
votes
1
answer
76
views
Why Memcached is empty
I've added memcached to LAMP stackand Wordpress and everything seems fine except the memcached memory is empty.
When I check with memcdump --servers=127.0.0.1 it returns nothing. Also when I connect ...
0
votes
0
answers
62
views
Apache2 with GSSAPI auth, can't exclude one location from auth
We have an apache2 serving a PHP application, with kerberos authentication
We developed an API within the PHP application, and we want to access it without Kerberos auth
But we cannot manage to ...
0
votes
0
answers
73
views
Two Virtual Hosts with to disntinct PHP configurations via PHP-FPM on Ubuntu and Apache
I have to Virtual Hosts on Ubuntu 20.04. One host is test instance and one is production (I know it would be better to have it separate). Now I need to run different php config for test vhost than for ...
0
votes
0
answers
26
views
Ubuntu Apache2 mod headers - not adding
I have an ubunutu server with apache2 server and I need to add a custom header to every request. This seems very straightforward, but it's not adding the header.
I have enabled the module headers with ...
-2
votes
3
answers
89
views
Running a website on a LAN only
This is a big question, so I'm only looking for a high-level overview answer to help me research the bits I don't know.
Essentially the problem is this: I need to take a dedicated Mac Mini (or similar ...
0
votes
0
answers
58
views
PHP PEAR Mail STARTTLS failed error 220 with postfix
I'm running postfix with dovecot. I'm trying to use the PHP Pear Mail package to send e-mails, but I can't get it to work. The error I get is this: authentication failure [SMTP: STARTTLS failed (code: ...
0
votes
2
answers
464
views
How to force a server to return my IP address in IPv4 and not IPv6?
Scenario
I have a tiny PHP script on a server that echoes the IP address of any client reaching it so the address can be added to the cpanel MySQL remote hosts table via the API. I call this script ...
0
votes
1
answer
359
views
Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first
We've configured a Dockerfile containing the following code snippet:
#############################################
#### Image containing compiled libraries ####
####################################...
0
votes
1
answer
149
views
Connecting to Oracle Autonomous Database with PHP and OCI8
I'm using Oracle Cloud Infrastructure. I have a VM instance with Ubuntu-22.04-Minimal. Apache, PHP, and OCI8 are all installed and working.
When I try to connect to the database I get:
Warning: ...
0
votes
1
answer
192
views
PHP curl_init(), curl_exec() work from the command line but fail when browsed/accessed from a webserver
The following PHP script (when not anonymized) runs successfully at the commandline. It uses curl_init() and curl_exec() to retrieve JSON-formatted data, converts the result into an associative array, ...
0
votes
0
answers
62
views
Apache custom rewrite rule, using code
I would like to have Apache handle some custom URL rewrite code that I have. This code rewrites the following urls:
https://www.example.com/request?data=SOMEDATABLOB
into urls pointing to PHP pages. ...
0
votes
2
answers
740
views
High PHP-FPM CPU load (Laravel, Nginx, PHP 8.2)
The server I am running has 4 vCPU's, 14GB of RAM, 250GB Storage. I get on a 1 minute interval average over a working day (7 hours) around 400-500 requests per minute.
I have increased the php-fpm ...
0
votes
0
answers
28
views
Why can't intl.so find libicu?
On macOS 13.6 (Ventura) I have ICU installed in /usr/local and configured PHP with --prefix=/usr/local/php8x (for php80, php81, and so on).
The configure script has no problem finding libicu, but at ...
1
vote
3
answers
798
views
Enabling gd extension in PHP for wordpress deployment
My Wordpress site was warning me that:
Error The required module, gd, is not installed, or has been disabled.
I started looking into this and found that it is disabled by default in php.ini:
;...
0
votes
0
answers
70
views
NGINX + Wordpress Config: Install Wordpress under subfolder but with a separate root?
I have a problem which I came close to solving but last step failed me.
I have a WP install at www.example.com on Ubuntu/Nginx I have no issues there, I also wanted to have another installation for ...
1
vote
1
answer
112
views
Is there a tool like ClamAV to scan PHP and JS files?
We're offering a shared web hosting service, where many websites live on the same server.
Since a lot of people don't update their stuff, they get pirated all the time. Now, the websites are ...
0
votes
0
answers
171
views
Error using nonce in .htaccess Content-Security-Policy (CSP)
I am attempting to use Content-Security-Policy nonce and its generating an error.
The Error via console.log:
Refused to apply inline style because it violates the following Content Security Policy ...
0
votes
0
answers
102
views
comparing __FILE__ with $_SERVER['SCRIPT_FILENAME'] before sending header
I am new to PHP, I saw a code which has the following lines, what is the code trying to de here.
if (basename(__FILE__) === basename($_SERVER['SCRIPT_FILENAME'])) {
header("Location: https://...
0
votes
1
answer
61
views
Prevent a user with a valid session to directly access a json feed
I am using fullcalendar to fetch a json feed (https://fullcalendar.io/docs/events-json-feed).
<script>
var calendar = new Calendar(calendarEl, {
events: '/myfeed.php'
});
</script>
...
0
votes
1
answer
84
views
Very low resource usage on Openlitespeed (LOMP) on Ubuntu 22.04
I have been testing a custom PHP script on LOMP (Ubuntu 22.04) running on VirtualBox (2GB/2Core). First, I tried Apache and upon benchmarking the script, it could complete 10K requests in ~36s - ab ...
0
votes
1
answer
153
views
Apache + PHP with mod_php No timeout
I am actually working on Apache server 2.4 with PHP 8.2 (mod_php) & debian 11.2
Recently I sent a HTTP Request with more than 100 seconds without a timeout. This request executed a large MySQL ...
0
votes
1
answer
683
views
PHP openssl encryption aes-256-cbc and decryption using NODEJS
I have a PHP script used to encrypt data with openssl_encrypt() and the aes-256-cbc algo.
Encryption/Decryption works well using PHP, it's an old script.
I've been trying to decrypt the datas using ...
0
votes
1
answer
279
views
http_code 0 with Redhat php curl request
I can use lynx to access a website from the server fine. When I try to access the same website with a php curl instruction I get http_code=>0 from curl_getinfo($ch); The same php code on another ...
0
votes
1
answer
152
views
Laravel app routes not working when using domain name (fine with IP address) on AWS Lightsail
I am running a Laravel 10.x application on an Amazon Lightsail server here - 18.134.48.92
Currently when browsing to http://18.134.48.92/login I am correctly shown the login page (I am using Laravel ...
0
votes
1
answer
64
views
Need equivalent .htaccess rule in apache just like nginx so I can get everything in URL
I have a VPS where I am using nginx and uses following to do URL rewriting.
location / {
try_files $uri $uri/ /index.php?$args;
}
Then I simply go to index.php and use the following code to get ...
0
votes
0
answers
53
views
clamdscan returns "Clamav Daemon cannot be started" but clamd is running
I am using clamdscan to scan files uploaded to a website. If I run clamdscan from the command line it works fine. However, if I call from a PHP script it throws an exception:
App\Util\Exception\...
0
votes
2
answers
441
views
Missing php8.0-fpm sock file
I'm using Ubuntu 18.04.6 LTS and I used the following commands to install php8.0
sudo add-apt-repository ppa:sergey-dryabzhinsky/php80
sudo apt-get install php8
after running php -v it's running the ...
0
votes
1
answer
112
views
PHP mail.add_x_header not showing in log
On Ubuntu 22.04 I have the following in /etc/php/8.1/apache2/php.ini (and have restarted Apache), and in /etc/php/8.1/cli/php.ini:
; Add X-PHP-Originating-Script: that will include uid of the script ...
0
votes
0
answers
119
views
Limit php-fpm to a specific sub directory generally handled by apache
I am facing the following legacy setup with php-7.4 and libapache2-mod-php7.4 installed and enabled:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html
<...
0
votes
0
answers
213
views
Permission issues in docker + laravel
I've been having this problem for a week and I don't know how to solve it. I started a small laravel project with Docker and Docker's mysql doesn't work at all. It keeps crashing by itself, when ...
0
votes
0
answers
39
views
Apache - How to compress (gzip) only specific calls
I have PHP application served with Apache 2.4
I need the apache to compress (mod_deflate - gzip) calls for specific users. So the application should decides dynamically which calls gets gzipped.
I was ...
-2
votes
1
answer
299
views
Unable to move uploaded files with php (Apache 2.4) - Permission denied
In my project I can't use move_uploaded_file PHP function because of:
Notice: PHP Request Startup: file created in the system's temporary directory in Unknown on line 0
Warning: move_uploaded_file(.....
0
votes
1
answer
123
views
installed homebrew openssl library not found when building MongoDb PHP driver on Mac
Similar to this questioner, due to a 502 Bad Gateway error, following the PHP docs I am attempting to build the PHP Mongo driver from scratch, using a modified ./config step
./configure --with-mongodb-...
0
votes
1
answer
74
views
Track down PHP crash running in lighttpd - no logs
0
Just recently I've started to see seemingly random crashes on a web server that has been stable for quite some time. I think PHP is crashing, but there are no crash logs so I'm only assuming that's ...
0
votes
0
answers
35
views
All .PHP pages give 5x error in nginx
I followed this guide to install Nginx and PHP on a CentOS server. I am able to do things like php --version and even use the interactive shell. But inside of /usr/share/nginx/html/, I make a PHP file ...
1
vote
1
answer
424
views
How to enable executing php files in Fedora Apache?
I installed httpd and php v8.2.11 on my Linux Fedora.
But Apache can't execute .php files. (Responses "Access denied.")
I tried to use chmod shell command to enable executing and add AddType ...