Changing php settings on shared hosting
Changing php.ini settings on shared hosting depends on how php is installed on your server. I
phpsuexe mode - CGI
In this mode, php scripts run as the user.
Just make a copy of php.ini and put it on your public_html folder, php will use the php.ini
PHP as Apache Module
In this mode, php scripts run as nobody.
To override php.ini settings, you can try adding following to .htaccess file.
Code:
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value output_buffering on
php_value max_execution_time 2000
php_value max_input_time 2000
php_value session.gc_maxlifetime 24400
Now check your phpinfo to see the values are changed, if not contact your web host to see if they can change the php.ini for you.
Re: Changing php settings on shared hosting
My webhost is now using phpSuExec as per the following article:
https://support.apthost.com/index.php?_ ... icleid=716
They say I can't have php directives in .htaccess (and I'm not entirely certain that now I need .htacess at all...do I?)
What do I need to put into .htaccess and php.ini to get vShare to work with phpSuExec? I don't know what goes where.
Since they changed to phpSuExec, none of my sites work. Here is their example php.ini (which is vastly different from directives in .htacess---notice the upload_max_filesize = 40M---needs to have the "equal" sign in it)
Code:
[PHP]
engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
;output_handler =
zlib.output_compression = Off
;zlib.output_handler =
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off
disable_functions =
disable_classes =
expose_php = Off
max_execution_time = 60 ; Maximum execution time of each script, in seconds
max_input_time = 120 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume (8MB)
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
arg_separator.output = "&"
variables_order = "GPCS"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
post_max_size = 40M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
include_path = ".:/usr/local/share/smarty:/usr/local/lib/php/pear"
doc_root =
user_dir =
extension_dir = /usr/local/lib/php/20050922
enable_dl = Off
cgi.force_redirect = 1
; cgi.nph = 1
; cgi.redirect_status_env = ;
; fastcgi.impersonate = 1;
;cgi.rfc2616_headers = 1
file_uploads = On
upload_tmp_dir = /usr/local/www/php/tmp
upload_max_filesize = 40M
allow_url_fopen = On
user_agent="PHP"
default_socket_timeout = 60
[Syslog]
define_syslog_variables = Off
[mail function]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
;mail.force_extra_parameters =
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On
mysql.max_persistent = 20
mysql.max_links = -1
mysql.default_port = 3306
mysql.default_socket =
mysql.default_host = localhost
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLI]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host = localhost
mysqli.reconnect = Off
[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = 20
pgsql.max_links = 40
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[dbx]
dbx.colnames_case = "lowercase"
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.save_path = "/tmp"
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 1
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Sockets]
sockets.use_system_read = On
[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.typelib_file =
; allow Distributed-COM calls
;com.allow_dcom = true
; autoregister constants of a components typlib on com_load()
;com.autoregister_typelib = true
; register constants casesensitive
;com.autoregister_casesensitive = false
; show warnings on duplicate constat registrations
;com.autoregister_verbose = true
[mbstring]
;mbstring.language = Japanese
;mbstring.internal_encoding = EUC-JP
;mbstring.http_input = auto
;mbstring.http_output = SJIS
;mbstring.encoding_translation = Off
;mbstring.detect_order = auto
;mbstring.substitute_character = none;
;mbstring.func_overload = 0
[exif]
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel = JIS
[Tidy]
;tidy.default_config = /usr/local/lib/php/default.tcfg
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
; Local Variables:
; tab-width: 4
; End:
[Zend]
zend_extension_manager.optimizer=/usr/local/lib/php/20050922/Optimizer
zend_extension_manager.optimizer_ts=/usr/local/lib/php/20050922/Optimizer_TS
zend_optimizer.version=3.0.0
zend_extension=/usr/local/lib/php/20050922/ZendExtensionManager.so
zend_extension_ts=/usr/local/lib/php/20050922/ZendExtensionManager_TS.so
Re: Changing php settings on shared hosting
OK, I *think* I have it figured out. I did this and so far things seem to work.
.htaccess (note the last bit, that needs to be changed to your URL if you use this code)
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^admin$ - [L]
RewriteRule ^admin/(.*) - [L]
RewriteRule ^install$ - [L]
RewriteRule ^install/(.*) - [L]
RewriteRule ^$ index.php
RewriteRule ^view/(.*)/(.*)/ view_video.php?id=$1 [L,QSA]
RewriteRule ^tag/(.*)/(.*) tag.php?search_id=$1&page=$2 [L,QSA]
RewriteRule ^channel/(.*)/(.*)/recent/(.*) video.php?category=recent&chid=$1&page=$3
RewriteRule ^channel/(.*)/(.*)/viewed/(.*) video.php?category=viewed&chid=$1&page=$3
RewriteRule ^channel/(.*)/(.*)/ channel_detail.php?id=$1
RewriteRule ^detailed/recent/(.*) video.php?category=recent&page=$1&viewtype=detailed
RewriteRule ^detailed/viewed/(.*) video.php?category=viewed&page=$1&viewtype=detailed
RewriteRule ^detailed/discussed/(.*) video.php?category=discussed&page=$1&viewtype=detailed
RewriteRule ^detailed/favorites/(.*) video.php?category=favorites&page=$1&viewtype=detailed
RewriteRule ^detailed/rated/(.*) video.php?category=rated&page=$1&viewtype=detailed
RewriteRule ^detailed/featured/(.*) video.php?category=featured&page=$1&viewtype=detailed
RewriteRule ^detailed/random/(.*) video.php?category=random&page=$1&viewtype=detailed
RewriteRule ^recent/(.*) video.php?category=recent&page=$1
RewriteRule ^viewed/(.*) video.php?category=viewed&page=$1
RewriteRule ^discussed/(.*) video.php?category=discussed&page=$1
RewriteRule ^favorites/(.*) video.php?category=favorites&page=$1
RewriteRule ^rated/(.*) video.php?category=rated&page=$1
RewriteRule ^featured/(.*) video.php?category=featured&page=$1
RewriteRule ^random/(.*) video.php?category=random&page=$1
RewriteRule ^rss/new/ rss.php?type=new [L]
RewriteRule ^rss/comments/ rss.php?type=comments [L]
RewriteRule ^rss/views/ rss.php?type=views [L]
RewriteRule ^group/(.*)/members/(.*) group_members.php?urlkey=$1&page=$2
RewriteRule ^group/(.*)/videos/(.*) group_videos.php?urlkey=$1&page=$2
RewriteRule ^group/(.*)/add/(.*) add_video.php?urlkey=$1&page=$2
RewriteRule ^group/(.*)/fav/(.*) add_favour.php?urlkey=$1&page=$2
RewriteRule ^group/(.*)/topic/(.*) group_posts.php?urlkey=$1&tid=$2
RewriteRule ^group/(.*)/invite/ invite_members.php?urlkey=$1 [L,QSA]
RewriteRule ^group/(.*)/ groups_home.php?urlkey=$1 [L,QSA]
RewriteRule ^groups/(.*)/(.*)/(.*) groups.php?chid=$1&page=$3
RewriteRule ^groups/(.*)/(.*) groups.php?category=$1&page=$2
RewriteRule ^include/(.*) http://www.vshare.in
RewriteRule ^pages/(.*).html$ show_page.php?name=$1 [QSA,L]
RewriteRule ^([^/\.]+)/favorites/(.*) user_favorites.php?username=$1&page=$2
RewriteRule ^([^/\.]+)/playlist/(.*) playlist.php?username=$1&page=$2
RewriteRule ^([^/\.]+)/friends/(.*) user_friends.php?username=$1&page=$2
RewriteRule ^([^/\.]+)/public/(.*)$ user_videos.php?username=$1&type=public&page=$2
RewriteRule ^([^/\.]+)/private/(.*)$ user_videos.php?username=$1&type=private&page=$2 [L,QSA]
RewriteRule ^([^/\.]+)/groups/(.*)$ user_groups.php?username=$1&page=$2 [L,QSA]
RewriteRule ^([^/\.]+)?/?$ user.php?username=$1 [L,QSA]
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
<IfModule mod_gzip.c>
mod_gzip_on No
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?YOURDOMAIN.COM(/)?.*$ [NC]
RewriteRule \.(flv|swf|png|bmp|js|css|jpg|jpe?g|gif)$ templates/images/logo.jpg [L,NC]
php.ini
Code:
upload_max_filesize = 100M
post_max_size = 100M
output_buffering = on
max_execution_time = 1000
max_input_time = 1000
session.gc_maxlifetime = 14400
max_execution_time = 6000000
max_input_time = 600000
output_buffering = On