I have confirmed the config
sendmail_path = xxxx
in .user.ini will not apply to subdirectories only the parent directly. ( the other configs will )
If I place another .user.ini in subfolder, it works. php.ini in subfolder will work as well.
That will lose the purpose of using .user.ini. for me in this case. May I ask is this PHP bug ?? and the possible reason of cause?
My environment is Linux with WHM, php version 5.6.
Given this structure:
.
└── a
├── a.php
├── b
│ ├── b.php
│ └── .user.ini <== [1]
└── .user.ini <== [2]
b.php will see settings from [1] merged with [2], where values in [2] replace those from [1]. a.php will see settings only from [2].
sendmail_path is defined as being PHP_INI_SYSTEM, meaning it can only be set in the system level settings file, e.g. php.ini.
Related
i have a created project using symfony 5.
For hosting website i am using amazon AWS.
Amazon AWS instance is using nginx.
Everytime i deploy code using Elastic beanstalk i have to add following lines to the etc/nginx/nginx.conf file
location / {
try_files $uri $uri/ /index.php?$args;
}
if i don't add following configuration and don't restart nginx server then only page of my website is visible . Whenever i try to open another page of website excepts homepage i get following error :
404 Not Found
nginx/1.18.0
How can i automate deployment of the ngnix configuration whenever i upload code using elasticbeanstalk ?
If you want to modify your nginx configuration, you should modify your Configuration Files by extending ElasticBeanstalk as explained here
I will assume you are using Amazon Linux 2, if not the ElasticBeanstalk is working completely differently as documented here.
Elastic Beanstalk (using Amazon Linux 2) will automatically look for a .platform directory at the root of your zip file.
By adding .platform/nginx/conf.d/elasticbeanstalk/php-custom.conf with the following content, you should be good to go (assuming you are using the default configuration). Note that you could overwrite the nginx.conf by adding this file .platform/nginx/nginx.conf to your project, but since what you want to do is fairly simple, I would only add a file that will be automatically loaded by nginx.
location / {
try_files $uri $uri/ /index.php?$args;
}
So your project tree should look something like this.
project root
├── .platform
│ └── nginx
│ └── conf.d
│ └── elasticbeanstalk
│ └── php-custom.conf
└── your project files
I have two Laravel applications with one domain. Let say the domain is mydomain.com.
I want those two applications can be accessed via the following urls:
mydomain.com/firstapp
mydomain.com/secondapp
To realize this, this is what I have done.
configured Apache so that the starting directory is /var/www/html/
<VirtualHost *:80>
DocumentRoot "/var/www/html/"
ServerName mydomain.com
</VirtualHost>
Then I put the first app source code in the /var/www/html/firstapp directory, and the second app in the /var/html/secondapp directory.
The directory structure became like this:
var
└── www
└── html
├── firstapp
│ ├── app
│ ├── bootstrap
│ ├── config
│ ├── database
│ ├── ...
│ ├── index.php
│ └── .htaccess
└── secondapp
├── app
├── bootstrap
├── config
├── database
├── ...
├── index.php
└── .htaccess
Finally, I moved the index.php and .htaccess from the corresponding public folder in the root directory of each Laravel app and modified the corresponding path in those index.php files.
So far, it is working as I expected, but I am worried about the security.
Can anyone explain to me the right way to do it.
Note: I am using Centos 7 in the server.
I have configured a new FPM pool (config file www.conf in pool.d), now let's say I want to disable mysql support for that specific pool ? Or maybe there is a way not to load that extension for that pool ?
I'm using debian 9 and here is how the file structure looks like this:
/etc/php/7.0/fpm$ tree
.
├── conf.d
│ ├── 10-mysqlnd.ini -> /etc/php/7.0/mods-available/mysqlnd.ini
│ ├── 10-opcache.ini -> /etc/php/7.0/mods-available/opcache.ini
│ ├── 10-pdo.ini -> /etc/php/7.0/mods-available/pdo.ini
│ ├── 20-calendar.ini -> /etc/php/7.0/mods-available/calendar.ini
│ ├── 20-ctype.ini -> /etc/php/7.0/mods-available/ctype.ini.ini
(...)
├── php-fpm.conf
├── php.ini
└── pool.d
├── forgewww.conf
└── www.conf
extension=thing.so can be found in files conf.d/<extension>.ini. Problem is all those extensions once configured seem common to all pools...
I've also tried to disable mysql extensions globally with phpdismod then append a line in www.conf with:
php_admin_value[extension] = mysqli.so
Which doesn't seems to work (the above doesn't enable mysqli for that pool)
You can't load different extension per-pool, the extensions are defined in an .ini file, loaded by master process. php-fpm master process forks into children, meaning that they share what's been loaded by the master process. You can't have a child load a different set of extensions after forking, or unload them. It probably is possible to develop a solution, but there's really no need for that seeing that you can solve your problem via different approach.
In order to achieve what you're after, simply set up entirely different php-fpm process on a different port / unix socket and load extensions you require, set up your pools and you're done. It's actually a lot less work than it sounds, it probably won't take you more than a few minutes.
I have a ZF2 application and want to write some integration tests for in. I'm using PHPUnit v6 (no zend-test). PHPUnit is set up and the Bootstrap class implemented. Everything is/was working.
For normal requests the framework scans the config folders (usually defined in the config/application.config.php: ['module_listener_options']['config_glob_paths']) and merges all the configs for me. But now I'm in the testing context and need some configs from a custom config file (e.g. config/autoload/module/audit-logging.local.php) -- and cannot find out, how to add/merge them to/with the other configs.
How to integrate configs from custom config files and make them available for the application, when running PHPUnit tests?
How about creating environment-specific configuration files, for example:
config
├── application.config.php
├── autoload
│ └── global.php
└── environment
├── development.php
├── production.php
└── testing.php
and then adjusting config/application.config.php to this:
return [
'modules' => $modules,
'module_listener_options' => [
'config_glob_paths' => [
__DIR__ . '/autoload/{,*.}{global,local}.php',
__DIR__ . '/environment/' . (\getenv('APPLICATION_ENVIRONMENT') ?: 'production') . '.php',
],
'module_paths' => [
__DIR__ . '/../module',
__DIR__ . '/../vendor',
],
],
];
Now all you need to do is configure the APPLICATION_ENVIRONMENT environment variable, and set it to testing, for example. Then you can configure the application for specific environments with corresponding configuration files in config/environment.
<phpunit>
<php>
<env name="APPLICATION_ENVIRONMENT" value="testing" />
</php>
<testsuites>
<testsuite name="Integration Tests">
<directory>.</directory>
</testsuite>
</testsuites>
</phpunit>
Works fine for me.
Using php5.6 (legacy codebase), apache, ubuntu16.
phpinfo() says that:
log_errors is on
error_log = /var/log/apache2/php_errors.log
When display_errors is on there is output.
But /var/log/apache2/ does not contain a php_errors.log file.
Have restarted apache (/etc/init.d/apache2 restart).
log_errors_max_len is 1024.
ls -ld /var/log/apache2
drwxr-x--- 2 root adm 4096 Mar 30 18:47 apache2
ls -l /var/log/apache2
-rw-r----- 1 root adm 0 Mar 30 06:25 access.log
-rw-r----- 1 root adm 5967 Mar 30 01:47 access.log.1
-rw-r----- 1 root adm 11618 Mar 31 04:07 error.log
-rw-r----- 1 root adm 11742 Mar 30 06:25 error.log.1
What am I missing?
From above comments. When using Apache2, each VirtualHost can have it's own log files.
So the /etc/apache2/ directory would have a sites-available directory along these lines:
├── sites-available
│ ├── 000-default.conf
│ ├── default-ssl.conf
│ ├── default-tls.conf
│ ├── www.domain.com.conf
│ └── www.domain.com-le-ssl.conf
And the www. files might look like the following example.
To set up specific php log file, separate from Apache logs, follow this answer:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/domains/example.com/html
ErrorLog /var/www/domains/example.com/apache.error.log
CustomLog /var/www/domains/example.com/apache.access.log common
php_flag log_errors on
php_flag display_errors on
php_value error_reporting 2147483647
php_value error_log /var/www/domains/example.com/php.error.log
</VirtualHost>