Can I have multiple php.ini files? - windows

I want to set the include_path variable in my php.ini file (C:\Windows\php.ini).
But, I want different include_path values for different sites hosted on the same Windows server. How can I do this?

http://php.net/manual/en/configuration.file.php says:
php.ini is searched for in these locations (in order):
. . .
You can review this list and see if one of the techniques helps in your case. For example, you can set the environment variable PHPRC, or you can put a different php.ini file in each current working directory, assuming each virtual host has a distinct cwd.
Note that when using Apache and mod_php, or other module embedding PHP in the web server (e.g. FastCGI), the php.ini file is read once, at web server startup. When you use PHP in a CGI manner, the php.ini file is read during every web request, so you have more opportunity to use a different php.ini.

You can set the php include_path from an .htaccess file, assuming you have the correct AllowOverride settings in your httpd.conf file. Here's an example how:
.htaccess
php_value include_path "d:\path\to\include"

As I understand the question, its more important to have individual include paths for each server/site then multiple php.ini files? Id say keep your code in PHP as far as possible.
Then you can just set the include_path with set_include_path or ini_set.
In apache you can set it in virtual domain or .htaccess file with php_value include_path "<first path to look>:<second path>:<etc>:.". IIS probably has a similar method.

Unfortunately, I don't think you can. However, some webservers can change PHP settings on an individual basis... Apache using mod_php has the php_value setting that you can set on various virtual hosts, IIS might have something similar, but I'm not sure.
set_include_path can also override the include path at runtime.
P.S. TF2 Engineer for the win.

Related

ElasticSearch 8: is there a "conf.d" folder to change settings without editing elasticsearch.yml?

I'd like to edit a few ElasticSearch 8 settings (for example: network.host), but I don't want to edit /etc/elasticsearch/elasticsearch.yml directly. What I'd like to do is to add my settings to my own file and put it in an hypothetical /etc/elasticsearch/conf.d folder, do be included automatically.
This approach is widespread with multiple other software I use (Nginx, Apache, MySQL, PHP just to name a few).
ElasticSearch already does what i need with /etc/elasticsearch/jvm.options.d, but that folder is just for the the JVM options, not for ES own settings.
What am I missing here?
You can override the config path via env variables:
ES_PATH_CONF=/path/to/my/config ./bin/elasticsearch
https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html
There is an old discussion about doing what you are asking about but didn't make it this way:
https://github.com/elastic/elasticsearch/issues/11362

Sharing the domain/subdomain urls created on vagrant machine?

What I have done till now.
1- I have used below vagrant box
https://scotch.io/bar-talk/introducing-scotch-box-a-vagrant-lamp-stack-that-just-works
2- After that I have created a virtual subdomain/domain on the Vagrrantmachine that are pointing to different folders on code directory
-- say abc.def.com pointing to var/www/public/pmtool
-- and aaa.def.com pointing to var/www/public/pmtool2
and these domains are enabled on virtual machine and running fine.
that is to say http://abc.def.com points to proper directory.
3- Now when I issue vagrant share command it provides me a url that is pointing to /var/www/public directory,
What I need to know that how I could get the urls aliases for these folders (domains/subdomains). i.e.an url alias to pointing to these directories.
You shouldn't feel too bad as other people have had this issue as well. The most relevant is this SO question, with the currently most upvoted answer being:
Change your WhateverItIs.conf file followingly by adding ServerAlias:
ServerName WhateverItIs.com
ServerAlias *.vagrantshare.com
and now you are good to go.
Another way to look at is that vagrant gives a url in the "vagrantshare.com" domain and what you want is to use "abc.def.com" and "aaa.def.com" still. The DNS that would make this possible would be for you to own the "def.com" domain and add CName records to it for both "abc.def.com" and "aaa.def.com", both pointing to the "vagrantshare.com" hostname generated for you by vagrant.

PHPMyAdmin automatic session destroy issue

I am using Ubuntu server with LAMP and I installed phpMyadmin to manage database. By default phpmyadmin session is destroying after 1440 sec.
I have gone through different online tutorials and forums but no method works.
According to the documentation:
Edit the phpMyAdmin config.inc.php and add (or edit) the $cfg['LoginCookieValidity'] directive, for instance $cfg['LoginCookieValidity'] = 10080
Edit the PHP configuration file php.ini (making sure to edit the correct one; you can use phpinfo() to locate the correct location) and extend the time for session.gc_maxlifetime to at least the same value you used for LoginCookieValidity.
EDIT
You don't want to change the session.gc_maxlifetime for all of your applications, but there's still hope. Since you are using Apache and if the corresponding <Directory> entry in your Apache configuration contains AllowOverride Options (or AllowOverride All), then you should be able to configure this on a per-application basis to only affect phpMyAdmin.
You'll need to create a .htaccess file in the top level of the phpMyAdmin directory and include a line like:
php_value session.gc_maxlifetime 10080
That will force the modified setting only for that folder (and subdirectories), so as long as it's in your phpMyAdmin folder it will only affect the phpMyAdmin application.
If you prefer, you should be able to create (or modify) an Apache vhost and edit the PHP setting directly in the Apache configuration; the configuration directive would be exactly the same,
php_value session.gc_maxlifetime 10080
These methods will only work if the AllowOverride directive is set to either All or Options; lesser settings such as None will not allow these changes.
More details.

.env data is not readable with config() function, nor \Config facade

I have a Laravel 5 application that works perfectly on multiple servers. But on a specific Server, the values of my .env file are not readable via the \Config facade, or the config() function.
Let me give an example with the APP_DEBUG environment entry, the same goes for all other entries.
My .env file (the same on all servers) consists, amongst others, of the following line:
APP_DEBUG=false
through the use of $app->environmentFile() I know, that my .env file is used.
When I directly output the debug param via env('APP_DEBUG'), I get the correct value (false), but all approaches to read the value from the config (\Config::get('app.debug'), config('app.debug'), app('config')->get('app.debug')) only returned NULL.
I also tried to clear the cache via artisan cache:clear, because I thought, there could be some caching issue, but that didn't change a thing.
I also tried set the permissions of the .env file to 777.
When I output my whole config via \Config::all(), all values that are correctly set on my other servers, are NULL on this specific server.
Any suggestions?
Edit for clarification:
The project is set up twice on the same server on two different Virtual hosts, one to serve the dev.domain.tld (for development), and one to serve the www.domain.tld (for production). Both folders use the same webserver, the same PHP version and the same user

max_execution_time in php.ini wont update, other settings will

So I've edited my php.ini file to allow for a longer max_execution_time, among some other settings. When I recycle the application pool in IIS 6 on windows server 2003 and check the php info file I've created, the other settings I've changed stick, but max_execution_time stays at it's default setting (300). What's up? It is not commented out and looks like this:
max_execution_time = 1800
Like I said, I've changed max_input_time to have the same value, and it works.
max_input_time = 1800
Reading a PHP Info file shows that the max_input_time is 1800 seconds, but max_execution_time still says 300. Thoughts on this?
Edit: The Loaded Configuration File listed within the phpinfo file is the file I'm working with. As I mentioned, other settings are taking effect, however, this specific setting is not. This means that it is indeed reading the file I'm editing, it just doesn't want to change the max_execution_time. I've also restarted the server.
please check your php.ini path first after then change in correct file.
or
if you change correct file then restart server
Try you can try to use set_time_limit(0);

Resources