- Could you please tell me what is homes directory under ${HOME} is used (created by default) for?
- I allow editing of PHP configuration so if I put a file ~/etc/php.ini and set some settings in it, it will override the default settings that are set in /etc/php.ini. I don't have to post complete php.ini with all settings in ~/etc/php.ini, just those I would like to change, right?
Thanks,
Regards, Ilia
Status:
Closed (fixed)
Comments
Submitted by JamieCameron on Sun, 03/17/2013 - 16:03 Comment #1
The
homes
directory is used to create mailbox user's home directories under.You do need to put a full
php.ini
in~/etc/
, as it is used instead of/etc/php.ini
. However, by default Virtualmin will create that full file for you when you create a virtual server, assuming that it is usingcgi
orfcgid
mode to execute PHP scripts.And in case I'm using mod_php?
Submitted by JamieCameron on Sun, 03/17/2013 - 19:21 Comment #3
If you are using
mod_php
, only the global PHP config file in/etc/
is used. There is no way to change this unfortunately..I see.
When I run it as
fcgid
I have etc directory in which I have php.ini and then another weird directory php5 which also contains php.ini? Is there a need for php5 directory or I just could safely delete it?What happens if I just delete etc directory whne using
fcgid
will it read /etc/php.ini? Or if I let this optional in templates then using local etc php.ini is the only way?For some unknown reason when I ran php as
fcgid
, only .php5 files were opening but not .php. - I mean default settings. php handler was also found in httpd.conf? Why would that be? When I tryyum install fcgid
it saysmod_fcgid-2.3.7-1.el6.x86_64 already installed and latest version
?Thanks, Ilia
Submitted by andreychek on Mon, 03/18/2013 - 09:37 Comment #5
When I run it as fcgid I have etc directory in which I have php.ini and then another weird directory php5 which also contains php.ini? Is there a need for php5 directory or I just could safely delete it?
The main php.ini file you're using is in $HOME/etc/php5/php.ini.
What you're seeings in $HOME/etc/php.ini is just a symlink to the main php.ini file.
So you wouldn't want to delete the php5 directory.
What happens if I just delete etc directory whne using fcgid will it read /etc/php.ini? Or if I let this optional in templates then using local etc php.ini is the only way?
You could always try renaming it if you want to see what happens... I probably wouldn't recommend that though, I suspect that'll cause it to run without any config file, and it'll confuse Virtualmin if someone tries to use it's PHP configuration options.
For some unknown reason when I ran php as fcgid, only .php5 files were opening but not .php. - I mean default settings. php handler was also found in httpd.conf? Why would that be?
I'm not sure why that would be, it should be able to execute .php files. Does that work when using CGI as the PHP Execution Mode?
I haven't checked it with CGI. I will figure it out later if I need to use php as fcgid
So you think I should consider using fcgid instea of mod_php?
The only difference, that when using mod_php, users on my system if using malicious Perl script, will be able to read files created by Apache, in general cache files and the files processed by Perl scripts or for example uploaded files? Correct? Or there is something else? What do you recommend for both speed and security?
Submitted by andreychek on Wed, 03/20/2013 - 09:32 Comment #8
FCGID and CGI are actually significantly more secure than mod_php. We'd only recommend mod_php on a system with trusted users.
Since mod_php accesses and executes scripts as the Apache user, it allows one user to be able to access files belonging to other users (which can contain passwords).
We find FCGID to be the best compromise between speed and security. It's nearly as fast as mod_php, and is much more secure in a shared hosting environment.
Well still I chosen upon domain creation in templates to use FCGID but it only runs PHP5 file and if you name a file .php it's shown blank? Why
Submitted by andreychek on Wed, 03/20/2013 - 12:41 Comment #10
By default, .php files should work.
What do these two commands show:
ls /etc/yum.repos.d/
ls -l /etc/httpd/conf.d/
Also, if you go into System Settings -> Re-Check Config, does it detect any problems?
Submitted by andreychek on Wed, 03/20/2013 - 12:42 Comment #11
Also, when it shows up as blank -- do any errors show up in the Apache error logs located in $HOME/logs/error_log?
Errors are not shown!
I use php 5.4.13 from remi.repo
No Errors on re-check
[root@host fcgi-bin]# ls -l /etc/httpd/conf.d/
total 44
-rw-r--r--. 1 root root 1009 Mar 9 18:37 awstats.conf
-rw-r--r--. 1 root root 455 Apr 23 2012 fcgid.conf
-rw-r--r--. 1 root mailman 641 Nov 21 00:11 mailman.conf
-rw-r--r--. 1 root root 1796 Apr 22 2005 perl.conf
-rw-r--r-- 1 root root 990 Mar 20 21:24 php.conf
-rw-r--r--. 1 root root 1671 Nov 30 17:27 python.conf
-rw-r--r--. 1 root root 392 May 17 2012 README
-rw-r--r-- 1 root root 2609 Mar 17 22:27 ssl.conf
-rw-r--r--. 1 root root 1042 Jun 23 2012 subversion.conf
-rw-r--r--. 1 root root 352 Sep 9 2004 webalizer.conf
-rw-r--r--. 1 root root 304 Mar 9 18:37 welcome.conf
Do i need this to be installed??
---> Package fcgi.x86_64 0:2.4.0-10.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
fcgi x86_64 2.4.0-10.el6 epel 40 k
Transaction Summary
=============================================================================================================================================================
Install 1 Package(s)
Please read my previous posts:
What is this found in php.ini?
; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below ; http://php.net/doc-root doc_root =
Submitted by andreychek on Wed, 03/20/2013 - 13:15 Comment #15
The issue is quite likely related to using a PHP version from a third party repository. It may have introduced a config change that's causing the problems you're seeing now.
First, I'd recommend disabling the remi repo, it's known to conflict with packages provided by Virtualmin.
Second, what are the contents of the file
/etc/httpd/conf.d/php.conf
?I cant go back to php 5.3.
Please send me default /etc/php.ini
Submitted by andreychek on Wed, 03/20/2013 - 13:27 Comment #17
The file you pasted in appears to be the
httpd.conf
file, not thephp.conf
.Can you paste in the contents of
/etc/httpd/conf.d/php.conf
? Thanks!Also, regarding the php.ini file -- I don't have a default php.ini file for CentOS 6, though you probably wouldn't want to copy in a php.ini file meant for a different PHP version.
Oh. yes!! I didn't click edit this file, sorry!! :)
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule !prefork.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#
# Allow php to handle Multiviews
#
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch \.phps$>
# SetHandler application/x-httpd-php-source
#</FilesMatch>
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
I wouldn't copy it!! I always try to sound plain dumb talking to tech-support : ))
Config for me looks good.
What this could be?
Submitted by andreychek on Wed, 03/20/2013 - 13:34 Comment #21
Ah, there we go! It looks like the PHP version from the remi repo added in a change that's overriding how .php files are processed.
What you'll need to do is edit the
/etc/httpd/conf.d/php.conf
file, and look for this line:SetHandler application/x-httpd-php
Then, comment out that line by putting a
#
in front of it, then restart Apache.Once you do that, are you able to execute .php files again?
Ah.. That was it! What about the rest of it?
Could you please send me your version of it? As it's on 5.3? (I will not plain copy it, I promiss :)))
Andrey, besides, could you please answer,
#!/bin/bash
PHPRC=$PWD/../etc/php5 <--- THIS field
export PHPRC
I have disabled the ability to edit php.ini for users from templates, BUT etc/php5 is still created by default!? Why? In this way I could delete it?
upload_tmp_dir exactly ${HOME}/tmp
. -> will it work for different users same way? Where are they set for the user, where do you edit them afterwards?Thanks a lot for your patience!!
Sincerely, Ilia
Submitted by andreychek on Wed, 03/20/2013 - 14:09 Comment #24
If you need the php.ini file provided by CentOS, what you can is download the PHP RPM that contains it, by running this command in a temp directory:
wget http://centos.arcticnetwork.ca/6/os/x86_64/Packages/php-common-5.3.3-22.el6.x86_64.rpm
And then run this command to extract the files:
rpm2cpio php-common-5.3.3-22.el6.x86_64.rpm | cpio -ivd
I recommend running the above as a non-root user, and in a temp directory.
Doing the above will extract the contents of the php-common RPM package, which includes the default php.ini file, as well as the various default .ini files that exist in /etc/php.d.
Submitted by andreychek on Wed, 03/20/2013 - 14:16 Comment #25
The FCGID and CGI modes are both designed to allow each user to have their own php.ini file. Although you've disabled the ability to edit that from within Virtualmin, the file still needs to exist.
The "PHP Configuration variables for scripts" options will place those particular settings into the user's php.ini file, located in $HOME/etc/php.ini.
You should be able to use variables like the one you mentioned,
${HOME}/tmp
-- that will be translated into/home/USERNAME/tmp
and then added to that user's php.ini file.You can edit the user's php.ini file after it's created if you wish.
That is what I needed!!
Thank you for your kinds warnings! But Total Commander and plugings - are just awesome!! I opened RPM on my windows with one-two-three! - Recommend!
Thanks a lot, Andrey!!
This is right. I see those settings under
php5/php.ini
!So if I'm getting it correct, each time I create a user, Virtualmin takes regular
/etc/php.ini
and just adds there some values from the section I mentioned above, like memory_limit, file_upload_path and etc. and puts it in to user's etc/php5/php.ini?Where is this path set, I mean
/php5/php.ini
, in case I want to change the default path to something else, as my site scripts are using this directory already?Sincerely, Ilia
Submitted by andreychek on Wed, 03/20/2013 - 14:35 Comment #28
Both /home/USERNAME/etc/php.ini and /home/USERNAME/etc/php5/php.ini are the same file, one is a symlink to the other.
You can change the php.ini file that's used as a template by going into System Settings -> Server Config -> Default -> Apache Website, and setting "Template PHP 5 configuration file".
Both /home/USERNAME/etc/php.ini and /home/USERNAME/etc/php5/php.ini are the same file, one is a symlink to the other.
You didn't get me right! I know they are symlinks! I mean uppon adding domain what it put in to
/home/USERNAME/etc/php5/php.ini
is derived from/etc/php.ini
(not talking about symblink which is in/home/USERNAME/etc/php.ini
I unfortunately couldn't find Server Config under System Settings in Virtualmin?
Submitted by andreychek on Wed, 03/20/2013 - 15:04 Comment #30
Sorry, I meant Server Templates, not Server Config.
Thanks! That's it! I read it before and have forgotten all about it. Thank you for you help!
We're done with this thread!
Have a great day!!