Globally disabled ini_set but Override ini_set for a domain - ini-set

I have disabled ini_set in PHP. I however want a specific domain to use ini_set. How do I enable ini_set for a specific domain?
Thanks

You can't. If you disable it there's no way from that function.
Maybe you can enable php.ini overrride, and put a individual php.ini to the desired folder to enable it and use set_ini again.
If you're using php as module, you can use .htaccess with php_flag or php_value to set desired values or flags.
Example:
php_value memory_limit 32M or php_flag display_errors 1 (display errors must work with value and flag rule as well)

Related

Wordpress: disable white screen of death, enable standard PHP errors

Is there any way to disable white screen of death (Error that says "Sorry, we are experiencing technical difficulties") and make it show the standard PHP errors? Have been looking for hours for solution:
I have set up the wp-config
ini_set('log_errors','On');
ini_set('display_errors','On');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);
I have enabled error reporting in php.ini.
Still, it does show error report for some errors and shows the white screen for others, and sometimes (not always) it adds the errors to error log. So, is there any way to stop this "smart" thing of wordpress and make consider the PHP error reporting as a priority?
Thanks
may be you should try looking
.htacces file
Some web hosting providers allow to modify php parameters from .htaccess file like this.
php_value display_errors 1
Here is php.net documentation for this.
https://www.php.net/manual/en/configuration.changes.php
Here are some more directives that you can add to htaccess or domain's httpd.conf
#hide php errors
php_flag display_startup_errors ON
php_flag display_errors ON
php_flag html_errors ON
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /home/path/public_html/domain/PHP_errors.log
php_value error_reporting 999999999
php_value error_reporting -1
php_value log_errors_max_len 0
Order allow,deny
Deny from all
Satisfy All

Apache VirtualHost confusion when using alias

So I have a setup that looks as follows:
www.mydomain.com - runs a complex multisite Wordpress install
www.mydomain.com/othersite - for various reasons this needs to run a totally separate install of Wordpress, but the URL must be in this format for historic reasons.
I'd like the "othersite" install of WP not to have to sit in the directory of the main multisite install, eg
/var/www/main-multisite
/var/www/othersite and NOT /var/www/main-multisite/othersite
My understanding is that I couldn't create a separate virtualhost for othersite, so I created an alias in the main virutalhost:
Alias /othersite /var/www/othersite
However when doing that, it seems the .htaccess file in /var/www/othersite is being ignored - I first noticed this as the permalinks in Wordpress don't work. I tried adding other directives into .htaccess but none work...so I then put gibberish into .htaccess to try and induce an error...but that didn't happen. So taht confirms my thinking that .htaccess is being ignored.
However, if I remove the alias from the Virtual host, and move things so we have
/var/www/main-multisite/other
everything works fine, and the .htaccess in the folder works ok! But this is not how I want things.
Can anyone help me shed any light on what I'm missing here?
Thanks in advance.
After you have set the Alias, you should set the group of directives to apply to the directory. You should add the <Directory> directive in apache config. The default config AllowOverride None will completely ignore .htaccess on the directory. You should also check the documentation about the <Directory> directive.
<Directory "/var/www/othersite">
Options FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

.htaccess internal server error if upload_max_filesize added [duplicate]

I am trying to increase the maximum post size limit on my server.
Here is the .htaccess file:
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
However it does not seem to work and throws a 500 Internal server error.
Any ideas why this could be happening and how to overcome this?
As far as I can tell, your syntax is correct. However, the php_value Apache directive is provided by the mod_php module. If you don't run PHP as Apache module (e.g., it runs as FastCGI or with some other SAPI) that directive won't be defined, thus the 500 error.
There're many ways to change PHP settings. In practice, I've found that hosting services that run CGI often provide a custom php.ini file somewhere in your FTP account. Additionally, if you run PHP/5.3.0 or newer you can use .user.ini files. Last but not least, there's ini_set() within code.

vague HTTP errors uploading larger files from within wordpress

I manage a small website for a private school, needing to post a variety of photos of videos. Most files larger than a few mb attempt to upload, usually the progress bar finishing (for whatever that's worth) and then before it reloads the Media Library it just gives a vague HTTP error on the page.
I've researched this as much as possible and nothing I've tried seems to do anything.
Current htaccess settings based on others' suggestions...
SetEnv MAGICK_THREAD_LIMIT 1
<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$">
Satisfy Any
Order allow,deny
Allow from all
Deny from none
</FilesMatch>
<IfModule mod_php5.c>
php_value post_max_size 128M
php_value upload_max_filesize 128M
php_value memory_limit 256M
</IfModule>
Tried disabling all plugins and no change I was able to notice.
Server setup..
GoDaddy Deluxe Shared
Wordpress 4.8 (latest)
PHP Version 5.6.30
CGI/FastCGI
I know it makes more sense to let Vimeo/YT/etc handle videos but they're worried about privacy since it's kids so preferred to keep everything on-site and as far as I can tell you can't embed videos with privacy options enabled, which makes sense.
GoDaddy's not much help. Can anyone point me in the right direction or have a fix that works? Happy to provide any other info needed.
Thanks! Rich

nginx php5-fpm loading old php.ini file

I have a PHP-based site running off the usual Nginx and php5-fpm combination. The sites-available config has a few different server blocks in it, e.g. one for the main www.mysite.com and one for blog.mysite.com subdomain. Originally, when I first created the site, I set the auto_prepend_file PHP value in my php.ini (in /etc/php5/fpm/), to let's call it 'common.php'. However, I now don't want common.php included for the blog subdomain, so I removed auto_prepend_file from php.ini and added it to the sites-available for the www subdomain, via
fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/mysite/app/lib/common.lib.php";
Nothing too fancy there. However, despite restarting both nginx and php5-fpm, I can still sometimes see common.php being included, generally after you've restarted nginx & php5-fpm, reloaded the page, then reload again, i.e. it's fine on the first reload.
When I do a phpinfo() when the file is included, I can see that PHP has loaded the correct php.ini file (i.e. the one I removed the auto_prepend_file from), but the auto_prepend_file value is still set to common.php!
Is there anything else I need to restart? Should I be looking for auto_prepend_file somewhere other than /etc/php5/fpm/php.ini? Thanks

Resources