• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Using custom php.ini for Php in FastCGI mode per-domain

ProWebS

Regular Pleskian
Hello,

I did follow the instructions here http://kb.odin.com/9059
in order to use custom options in a php.ini for a domain running FastCGI.

the problem is that after I did everything described, and restared apache, still the vhost didnt run withe the php options at /var/www/vhosts/mydomain.tld/conf/php.ini

and while I was refreshing the website I took a look at "top" command and saw this:

31167 "vhostname" 15 0 152m 10m 6160 S 0.3 0.1 0:00.03 /usr/bin/php-cgi -c /etc/php.ini

so its all clear that still apache and fascgi is using /etc/php.ini and not /var/www/vhosts/mydomain.tld/conf/php.ini

why is that?
 
ok I've found what it was wrong, it was the permissions of the php.ini file, the correct ones are:

-rw-r--r-- php.ini

now it's working great.
 
what about subdomains with sep. php.ini

Hello Forum

The instruction in kb 9059 from parallels work great for me (Plesk 9.5.4 / Lenny 64bit / PHP 5.2.6) for every domain.

My Problem are still the subdomains.

If I change the php-mode from "apache" to "fast-cgi" for a subdomain and do the same things with the php.ini and the conf-folder for a subdomain the only thing I receive is the following error:

No Input file specified


Same thing even without own php.ini-file.


Does anybody know how to fix this, so that I am able to run fast-cgi in a subdomain with or without own php.ini-file?

Thanks in advance!

Greetings from Switzerland
Andrew
 
Hello Forum

After searching the internet about the fastcgi with custom php.ini for subdomains without success, I found myself a way to do this:

My System:
Plesk 9.5.4 / Lenny 64bit / PHP 5.2.6


1)
Modified the file cgi_wrapper (found under /var/www/cgi-bin/cgi_wrapper) as follow:

#!/bin/sh

domain=`grep ":$UID:" /etc/passwd | cut -d: -f6`

PHPRC=$domain/conf/php.ini

[ -f ${PHPRC} ] || PHPRC="/etc/php.ini"

export PHPRC
exec /usr/bin/php-cgi -c "$PHPRC"


2)
Create a separate ftp-user for the subdomain


3)
chmod the conf-directory under the subdomain-path to 0755


4)
Copy a php.ini-file to the conf-directory of the subdomain and modify this file to your needs.


5)
Let plesk reconfigure the hole vhost.
This step is perhaps not really necessary, but I do it with

/opt/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.tld


6)
restart the apache


From here on, it work like a charme for the maindomains and the subdomains, even if a maindomain has php as apache-module and its subdomains has php as fastcgi with a custom php.ini

For a secondary subdomain or a subdomain from another maindomain you just need to follow the steps 2-6.

Greetings from Switzerland
Andrew
 
Back
Top