No php ini file was founded

No php.ini!

I’ve just discovered I have no php.ini file on my server. According to phpinfo() it should be at /usr/local/etc/php.ini but I have no such file. According to the PHP manual I should copy either the development or production version to that location and then edit it for my needs, but I can’t find those on my machine either! I installed www/mod_php72 using ports-mgmt/pkg.

Where can I get these files for use on FreeBSD or do we really not need them?

Phishfry

kjpetrie

Evidently, you did not understand my post. These files are not installed by www/mod_php72, so they can’t be copied internally. I have since obtained copies of the files from PHP’s Github and uploaded those, as better than nothing. However, it would be better to have FreeBSD versions of the files to ensure compatibility with paths.

m0nkey_

They wont be, as mod_php is an Apache module. You need to install the php72 package which will install the requisite ini files in /usr/local/etc.

usdmatt

They are definitely provided with phpXX as I’ve installed this several times recently.

mod_php doesn’t actually seem to rely on any php package (don’t quite see what use it is as AFAIK mod_php can’t pass requests to an external service like php-fpm can), so have you actually got php installed?

Edit: Looking at the first post, if you’re running phpinfo on this host then you clearly have php installed. Which only leaves these files being removed somehow.

kjpetrie

I have only www/mod_php72 on this machine, installed in two jails which run web servers. lang/php72 is not installed, so it is clear www/mod_php72 is sufficient to run PHP in Apache. However, that being the case, surely it should contain at least one sample php.ini to complete or enable set-up. I shouldn’t have to go hunting on line for it when I realise belatedly it’s missing.

SirDice

Administrator

A number of php72-* modules are going to depend on lang/php72.

# pkg info -r php72 php72-7.2.27: php72-calendar-7.2.27 php72-dom-7.2.27 php72-filter-7.2.27 php72-gd-7.2.27 php72-json-7.2.27 php72-pdo_mysql-7.2.27 php72-session-7.2.27 php72-simplexml-7.2.27 php72-xml-7.2.27 php72-pdo-7.2.27 webtrees-1.7.13

kjpetrie

Yes, but as you can see www/mod_php72 isn’t one of them, so it’s a little odd to expect someone to install it just to get a configuration file for something that doesn’t need it.

Actually, I do have lang/php72 installed in another jail, and I have now found the files I wanted there, but unless PHP is a jailbreak mechanism that shouldn’t be relevant.

Читайте также:  Login page in html templates

msplsh

If you don’t have the php.ini file, all that happens is that everything goes to defaults. It’s not the end of the world, everything runs as normal and the port doesn’t install it, only the template that you finally found. phpinfo() just lists whatever location it thinks you should put it.

🤷‍♂️

If you’re complaining that mod_php doesn’t install a sample but php does. I guess technically you can just install mod_php since both of them seem to install libphp7.so, but you probably want some modules. Maintainers expect you to know what you’re doing in this case

SirDice

Administrator

Different locations, so there’s no conflict. They can’t both install /usr/local/etc/php.ini-development and /usr/local/etc/php.ini-production because that would cause a file conflict. As www/mod_php72 works just fine without a php.ini (it uses fairly sensible defaults) it’s left up to the system administrator to configure it (as a lot of ports do).

root@webtrees:~ # pkg info -l mod_php72 | grep 'libphp' /usr/local/libexec/apache24/libphp7.so root@webtrees:~ # pkg info -l php72 | grep 'libphp' /usr/local/lib/libphp7.so

usdmatt

I wasn’t aware of this but it seems mod_php actually creates a completely standalone binary of php that is loaded into Apache as a module. As such, it doesn’t actually require the php port/pkg installed.

This is a fairly unlikely situation to be in though as, as SirDice says, as soon as you want to install a module, lang/phpXX will be a dependency. Due to the way the ports tend to disable all php modules by default, it’s almost useless for any half serious application without at least one module.

Seeing as mod_php doesn’t seem to rely on lang/php, maybe there is a plausible argument that it should install the sample ini files, although they would likely need different names to the ones installed by lang/php. Personally I would just install lang/php anyway, as it seems odd to just have mod_php installed on its own, and as mentioned any modules will require it anyway.

kjpetrie

I’m not sure what the assumptions behind this are. All I know is I want to run PHP on my websites and I use PHP extensively to build site functionality. I don’t need any add-ons, just the core language to code in and write my back-end functions. I was just shocked to discover by accident that the php.ini file wasn’t where I expected it when I wanted to set error_reporting and display_errors globally rather than on a per-application basis and then, on further investigation, find even the sample files I’m supposed to adapt weren’t there to be copied. Yes, they’d have to have different names or be in a different directory to avoid clashes, but that’s trivial enough to sort out. One could even have the actual .ini in a different location to allow the CLI and web versions to be installed on the same machine with different configurations for different uses.

Читайте также:  Java найти ближайшее число

But it’s all getting a bit academic now as I’ve solved the initial problem and got sensible settings in place for development and production. I know the module runs well without the file — I’ve used it for months without the file and my sites work well and I doubt a third party accessing would notice any difference, but it’s one less thing to worry about now when I’m writing scripts, as my systems now have error handling defaults which suit their purposes. It’s also enabled me to disable phpinfo on the production server, as that’s obviously not something you’d want someone to see if they managed to trick the server into running it!

I don’t think this could be considered solved. I’m not sure it’s even soluble as there appears to be room for different opinions and we clearly don’t see the issue the same way. However, I no longer need help on this issue so I’m happy to leave it here.

Community platform by XenForo ® © 2010-2022 XenForo Ltd.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.

This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.

Источник

php.ini does not exist

There is no php.ini after installing php (7.1) on ubuntu 16.04 I installed php using apt install php . I already tried to find the php.ini using the find command, but there is no file called php.ini anywhere.

If one of the below answers works for you, please accept it by clicking the checkmark icon. If none works for you, please edit your question and add a postscript to say so.

5 Answers 5

I recently setup a wordpress server and ran into this same issue.

I used apt-get install php

Everything seemed to be normal except I could not find the php.ini file either. That file is usually located in /etc/php/7.0/apache2/php.ini

My solution, and I guess is also your solution would be that apache mod didn’t get installed for php. So all you need to run is apt-get install libapache2-mod-php

I also bounced apache just to be safe, but then my php.ini file was then located where I expected it in /etc/php/7.0/apache2/php.ini

Try using the command php —ini . Since you’re running command line, it won’t necessarily show you the config files you may be looking for (apache, nginx, etc), but it will hopefully get you on the right path.

$ php --ini Configuration File (php.ini) Path: /etc/php/7.0/cli 

Which tells me if I’m looking for Apache files, I can find the rest up one directory from there:

$ ls /etc/php/7.0/ apache2 cli fpm mods-available 

If all else fails, and you’re able to browse to a .php file on the server, create a file using phpinfo like this and take a look to see what ini files are in use:

Читайте также:  Java зачем нужен интерфейс

Kindly use the locate command instead. Here is my output:

subroot@subroot:~$ find php.ini find: ‘php.ini’: No such file or directory subroot@subroot:~$ locate php.ini /etc/php/7.0/apache2/php.ini /etc/php/7.0/apache2/php.ini.ucf-dist /etc/php/7.0/apache2/php.ini.ucf-old /etc/php/7.0/cli/php.ini /etc/php/7.1/apache2/php.ini /etc/php/7.1/apache2/php.ini.ucf-dist /etc/php/7.1/cli/php.ini /usr/lib/php/5.6/php.ini-development /usr/lib/php/5.6/php.ini-production /usr/lib/php/5.6/php.ini-production.cli /usr/lib/php/7.0/php.ini-development /usr/lib/php/7.0/php.ini-production /usr/lib/php/7.0/php.ini-production.cli /usr/lib/php/7.1/php.ini-development /usr/lib/php/7.1/php.ini-production /usr/lib/php/7.1/php.ini-production.cli subroot@subroot:~$ 

Type man find and man locate for the difference between the two commands.

Источник

Why is there no php.ini file when I install PHP in a docker container?

The container also has /usr/local/etc/php/conf.d and will read and parse every configuration file in that directory.

Notice that it will still say Loaded Configuration File => (none) , but that it will also say Additional .ini files parsed and there you will see it walking through that directory . and the various files that the container puts there: docker-php-ext-XXX.ini . (So it’s rather misleading for it to say (none) . )

It’s useful to do things like this:

 php -r 'phpinfo();' | grep -i conf 

. which in this case will very quickly show you only the lines in PHP’s voluminous output that contain (in upper or lower case) the string conf .

Solution 2

You need to add php.ini file:

docker run -d —name php-tmp php:5-fpm

docker cp php-tmp:/usr/src/php.tar.xz .

  1. Add volume with php.ini in php container volumes:
    • .root:/var/www/html:ro
    • ./php/php.ini-development:/usr/local/etc/php/php.ini

Where is the PHP ini file located on my MAMP localhost

Running PHP in Docker Containers

How To Work With PHPs Configuration File - PHP.INI - Full PHP 8 Tutorial

Install xDebug 3 and PHP 8 in a Docker Container and Connect it with PHPStorm

How to change docker php.ini and change php memory size in docker

cant update php.ini file in Docker container - PHP

skb

Updated on September 18, 2022

Comments

I’m using docker-compose to setup a minimal nginx + php-fpm application but for some reason there is no php.ini file on the docker container (I know because phpinfo() says Loaded Configuration File: (none) ). Here’s my docker-compose.yml file:

web: image: nginx ports: - "8080:80" volumes: - ./site.conf:/etc/nginx/conf.d/site.conf links: - php php: image: php:5-fpm volumes: - .root:/var/www/html:ro command: bash -c "apt-get update && apt-get install -y php5-mysql && php-fpm" 

I really don’t want to start from scratch if I don’t have to. Is there supposed to be a php.ini file included with the php:5-fpm docker image? If not, is there a generic file I could use to start with?

Does the container you chose include a php.ini? What did the maintainer of the container tell you when you asked?

Источник

Оцените статью