I active custom user php.ini . now user's can have their own .user.ini.
now i want some of my user use this feature and other deny from using custom .user.ini
so i uncomment line :
; To disable this feature set this option to empty value
user_ini.filename =
now this feature is disable for all user, how can i active it for user1 not all of them(exm) ?
server is LAMP with no panel of course
CentOs 6.x apache + SUphp FaCGI
I used this directive in virtual host but it didn't work
DocumentRoot /home/mam/public_html
ServerName mam.test.ir
suPHP_Engine on
suPHP_UserGroup mam mam
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php
php_value user_ini.filename ".user.ini"
suPHP_ConfigPath /home/mam/public_html
is there any idea ?????? NOTE: I don't want to use .htaccess for this
I figured it out myself :|
For doing this you have to way one is include file and second is:
suPHP_ConfigPath /home/mam/public_html/php.ini
You need to use absolute path :)
A trick could be to use CHMOD to make the .user.ini in the specific virtual host document root readable and writable only to the admin/root user (feature disabled) or to the user too (feature enabled).
Related
I have setup php/apache according to this linode guide: https://www.linode.com/docs/guides/install-php-8-for-apache-and-nginx-on-ubuntu/
This seems to have worked, and I have an apache server that can serve files, and process .php files.
However, I am having the darndest time figuring out how to tell apache to process .html files with .php. Any modification I make to .htaccess (a-la- https://manage.accuwebhosting.com/knowledgebase/2492/Parse-HTML-As-PHP-Using-HTACCESS-File.html and similar) produce no change. I have also set AllowOverride All to the /var/www/ directory in /etc/apache2/apache2.conf. Additionally, most online information on the subject points to earlier versions of .php, with no specific reference to 8.0.
What can get apache to process .html with php 8.0?
You need to have module for this, confirm you have this line in httpd.conf, or add it there:
LoadModule mime_module modules/mod_mime.so
Also check if you have the modules/mod_mime.so file present on your system.
Then find or add module section in httpd.conf:
<IfModule mime_module>
# following line will change mime type of .html file to php
# and they will be handled as such
AddType application/x-httpd-php .html
</IfModule>
Directive AllowOverride All will enable .htaccess files but you need the mime_module enabled too.
And of course restart the apache server after making configuration changes.
Module documentation: here
System: LAMP stack running CentOS 6 and Virutalmin/Webmin.
I set up a subdomain using Webmin, within an existing main domain (also created with Webmin). The main domain runs as user 910, group 582. Placing a php script in the main domain's public_html dir with this code:
<? echo `whoami`; ?>
generates the username of the domain owner.
Placing the same script in the subdomain's public_html generates 'apache'.
Both directories and files have the same ownership (910:582).
In /etc/httpd/conf/httpd.conf both virtual hosts have the same SuexecUserGroup line:
SuexecUserGroup "#910" "#582"
I need the subdomain to run under the same user, so Wordpress can access the files directly. Otherwise I have to chown everything in the subdomain to apache:apache which is a security risk/bad practice.
What am I missing here?
Thanks!
Turns out this issue was due to several things:
mod_php5 being enabled by default. Adding the directive
php_admin_value engine Off
to the httpd.conf file for this virtual host disables mod_php5 which is incompatible with suexec.
Add FCGIWrapper directive, which wasn't created by Webmin
FCGIWrapper [home dir]/fcgi-bin/php5.fcgi .php
Create the php5.fcgi file in the fcgi-bin directory. I just copied this file from another virtual host as it's only a bash shell script to launch the php interpreter.
Add AddHandler and AddType directives to the main VirtualHost section and also the public_html <directory> section:
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
Ensure all file ownership and permissions are set correctly to the owner of the account.
Right now i have to give 777 permission to the directory where files are saved and instead of saving it as "user1" is saving it as apache
-rwxrwxrwx 1 apache apache 6865 Aug 30 17:20 homepage.tpl.php
How can the files be saved as user1 and without 777 permission outside my docroot wich is home/user1/public_html/
lets say in /home/user1/private/homepage.tpl.php
Im using a Centos LAMP with suPHP.
Thanks in advance.
Solved
To fix it I had to reinstall suphp with this conf.
/etc/suphp.conf
check_vhost_docroot=true
and use the correct handlers
[handlers]
;Handler for php-scripts
x-httpd-php="php:/usr/bin/php-cgi"
;Handler for CGI-scripts
x-suphp-cgi="execute:!self"
Inside the virtual host
suPHP_Engine on
suPHP_UserGroup user user
AddHandler x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler x-httpd-php
when i point my browser to http://localhost/phpmyadmin, instead of showing me its front page, it comes up with save as dialog.
I'm running:
Apache/2.2.3 (Debian) PHP/5.2.0-8+etch13 Server
I've reinstalled both apache2 and php5.
After re-install i don't have httpd.conf file, how can i get it back? Is there a standard file which i can just copy into /etc/apache2?
I did a locate httpd.conf and the only file i got was the empty file i have under /etc/apache2/ which i made.
Did you configure the php extension to send an http header?
In httpd.conf:
AddType application/x-httpd-php .php
EDIT
The file is not necessarily named httpd.conf, that's just the default name. Try searching for other configuration files in the Apache directory -- the extension probably is .conf but it might be something else...
If you used apt-get on debian to install apache2, try /etc/apache2/apche2.conf
/EDIT
I also get this problem when I install ISPconfig. I solved the problem by this tutorial:
http://www.howtoforge.com/perfect-server-debian-wheezy-apache2-bind-dovecot-ispconfig-3-p4
I think the main code is change suphp.conf config.
sudo nano /etc/apache2/mods-available/suphp.conf
comment out the <FilesMatch "\.ph(p3?|tml)$"> section and add the line AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml - otherwise all PHP files will be run by SuPHP
<IfModule mod_suphp.c>
#<FilesMatch "\.ph(p3?|tml)$">
# SetHandler application/x-httpd-suphp
#</FilesMatch>
AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-suphp
<Directory />
suPHP_Engine on
</Directory>
# By default, disable suPHP for debian packaged web applications as files
# are owned by root and cannot be executed by suPHP because of min_uid.
<Directory /usr/share>
suPHP_Engine off
</Directory>
# # Use a specific php config file (a dir which contains a php.ini file)
# suPHP_ConfigPath /etc/php5/cgi/suphp/
# # Tells mod_suphp NOT to handle requests with the type <mime-type>.
# suPHP_RemoveHandler <mime-type>
</IfModule>
Hope I can help someone :)
I think you just do not know where that config file is. I don't think apache can run without httpd.conf. Here is how you can find your config:
$>locate httpd.conf
/etc/httpd/conf/httpd.conf
$>vim /etc/httpd/conf/httpd.conf
Once you located it, find where other AddType reside and add
AddType application/x-httpd-php .php
Last thing you need to do is restart your httpd, it depends on install, but doing apachectl restart does the trick. You might have to locate it just like you did with httpd.conf file and type in the entire path to the file.
Afterwords, your phpmyadmin should come up.
I dont know anything about this but... does someone knows a way in javascript to download selected files, for example I select through checkboxes 2 files, and then I click on a button in order to download these 2 files choosing the route where i will save the archives
XAMPP makes configuring a local LAMP stack for windows a breeze. So it's quite disappointing that enabling .htaccess files is such a nightmare.
My problem:
I've got a PHP application that requires apache/php to search for an /includes/ directory contained within the application. To do this, .htaccess files must be allowed in Apache and the .htaccess file must specify exactly where the includes directory is.
Problem is, I can't get my Apache config to view these .htaccess files. I had major hassles installing this app at uni and getting the admins there to help with the setup. This shouldn't be so hard but for some reason I just can't get Apache to play nice.
This is my setup:
c:\xampp
c:\xampp\htdocs
c:\xampp\apache\conf\httpd.conf - where I've made the changes listed below
c:\xampp\apache\bin\php.ini - where changes to this file affect the PHP installation
It is interesting to note that c:\xampp\php\php.ini changes mean nothing - this is NOT the ini that affects the PHP installation.
The following lines are additions I've made to the httpd.conf file
#AccessFileName .htaccess
AccessFileName htaccess.txt
#
# The following lines prevent .htaccess and .htpasswd
# files from being viewed by Web clients.
#
#<Files ~ "^\.ht">
<Files ~ "^htaccess\.">
Order allow,deny
Deny from all
</Files>
<Directory "c:/xampp/htdocs">
#
# AllowOverride controls what directives may be placed in
# .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
The following is the entire .htaccess file contained in:
c:\xampp\htdocs\application\htaccess.txt
<Files ~ "\.inc$">
Order deny,allow
Deny from all
</Files>
php_value default_charset "UTF-8"
php_value include_path ".;c:\xampp\htdocs\application\includes"
php_value register_globals 0
php_value magic_quotes_gpc 0
php_value magic_quotes_runtime 0
php_value magic_quotes_sybase 0
php_value session.use_cookies 1
php_value session.use_only_cookies 0
php_value session.use_trans_sid 1
php_value session.gc_maxlifetime 3600
php_value arg_separator.output "&"
php_value url_rewriter.tags "a=href,area=href,frame=src,input=src,fieldset="
The includes directory exists at the location specified.
When I try to access the application I receive the following error:
Warning: require(include.general.inc) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\application\menu\logon.php on line 21
Fatal error: require() [function.require]: Failed opening required include.general.inc (include_path='.;C:\xampp\php\pear\random') in C:\xampp\htdocs\application\menu\logon.php on line 21
The include path c..\random\ is specified in the php.ini file listed above. The XAMPP install fails to allow another include path as specified in the htaccess.txt file.
I'm guessing there's probably an error with the httpd.conf OR the htaccess.txt file.. but it doesn't seem to be reading the .htaccess file. I've tried to be as thorough as possible so forgive the verbosity of the post.
Now I know a workaround could be to simply add the include_path to the PHP file, but I'm not going to have access to the php.ini file on the location I plan to deploy my app. I will, however, be able to request the server admin allows .htaccess files.
renamed htacces.txt to .htaccess and ammended the appropriate directives in the httpd.conf file and all seems to work. The application suggested the naming of htaccess.txt and the ammended directives in the httpd. These are obviously wrong (at least for a XAMPP stack).
By the way, using ini_set() is a much friendlier way if the app needs to be deployed to multiple locations so thanks especially for that pointer.
Why do you need to rename .htaccess to htaccess.txt
Try setting the include_path using set_include_path() and see if that helps (as an intermediate fix)
Verify which php.ini to use through a phpinfo()
You can alter the include_path on each request using ini_set(). This would avoid having to use htaccess at all.
My htaccess works under XAMPP fine - though some modules are disabled by default - are you sure that the modules you want are enabled?
I think the searchprase you are looking for is:
AllowOverride All
My guess is that within xampp you need to enable AllowOverride (through an .htaccess) in httpd.conf. It's a simple security measure that prevents newbies from installing a hackable platform :P
You need to enable AllowOverride All in main http.conf file. Look inside XAMPP_DIR/apache/conf/http.conf)
Simply Do this:
open file ...\xampp\apache\conf\httpd.conf
find line "LoadModule rewrite_module modules/mod_rewrite.so"
if here is a # before this line remove it.(remove comment)
its working