PHP is working even without php.ini - php

I have installed php by XAMPP and now I want to install the Phalcon dll, I have to add it to my php.ini
I did all the Phalcon installing steps but I did not get it is not working; I even removed my php.ini content and restarted Apache but php is still working!
IS PHP able to work without php.ini?

How PHP is working without php.ini?
php.ini file is not mandatory for PHP to work. It allows you to set up certain parameters, but if there's none then PHP defaults apply.
Why my php.ini is not working?
You are most likely playing with wrong one. Run script with
<?php
phpinfo();
and then look for location of php.ini. This will be the file you need to edit.

Run this code:
<?php phpinfo(); ?>
to get full path to your php.ini file you are using

Use phpinfo() to check details and the path to php.ini:
<?php phpinfo() ?>
phpinfo():
Outputs information about PHP's configuration
Because every system is setup differently, phpinfo() is commonly used to check configuration settings and for available predefined variables on a given system.

Related

How to override the php.ini file settings in laragon?

When i upgrade my php version from 7.1 to 7.2 there is new folder include in
c:\laragon\bin\php
which is right. But when i edit the php.ini file and enable openssl and other extension, save it and restart than it will override by the previous php.ini. It happens to two three times. I think there is a global php.ini file. If it has then how can we override this php.ini files with other versions php.ini?
If anyone knows please describe it or give me suggestion. Thanks
I think you just installed php incorrectly in laragon, check the folder "C:\laragon\bin\php\php-7.3.21\ext" and if this folder is empty then that would mean there is no extension, even after activation it will not change the "php.ini" file. I had the same problem.
Looks like the response
I think there is a global php.ini file
..is wrong. Please change anything (extension) in the specific php directory that you will use. This is the php directory of laragon on my local, if I will use php version 8, then I change the php.ini file in "php-8.0.8-nts-Win32-vs16-x64".
Like this:

Editing php.ini with MAMP 3.5 where is the right ini file?

I'm trying to edit my php.ini file to turn off short tags. Pretty standard.
phpinfo() tells me I am running PHP Version 5.6.10
I have edited 2 php.ini files so far, and neither has taken effect (yes, I restarted MAMP)
MAMP/conf/php5.6.10/php.ini
MAMP/bin/php/php5.6.10/conf/php.ini
Neither file changes the status of short tags
Can anyone direct me where/how to change my php.ini settings?
I really freaking miss WAMP. Whose bright idea was it to buy a Mac?!?
When you run phpinfo() you need to look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
Aaannnnnnnnddddd I was being a dufus
I had been commenting the line out instead of changing to "Off"
as you version is 5.6.10, and supposed your apache2 server runing on ubuntu.
php.ini dir is
/etc/php5/apache2/php.ini
On my Mac, running MAMP I have a few locations that would contain the likely php.ini
So I edited the memory_limit to different values in the 2 suspected files,
to test which one effected the actual MAMP PHP INFO page details.
By doing that I was able to determine that this was the correct php.ini:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini

How to make the server load php from another directory?

I have a dedicated server and I'm facing a strange issue. I found there 2 php installations and only one must be used and is correct, which is version 5.2.6, but currently, I see on phpinfo that the php.ini is being loaded isn't the right configuration. The php.ini which I need the server use is located in /opt/php-5.2.6/config/php.ini and the current in use is located in /etc/php.ini. How to turn on the php located in /opt/php-5.2.6/ ? I don't know what happened, maybe after I tried to install the xCache extension, but didn't work and in some way that installation of xCache changed where the php is loaded from.
How to make loading the php which I have in directory /opt/php-5.2.6/ ?
Thanks.
You can make your apache to point to another php.ini using .htaccess file.

I have configured curl but it does not work

I am using windows server and have ran the following code to find my php.ini.
<?php
infophp();
?>
Then uncommented the extension=php_curl.dll and set the extension path on my php.ini.
At last downloaded and installed curl and restarted my server but there is still no information about the curl in my info.php
I have php_curl.dll in my ext folder (extension folder), libeay32.dll and ssleay32.dll are also in root of my php folder.
I had this problem a few times and most of them web server was picking up wrong php.ini.
Make sure the one you are editing is being used. Try disabling php in it totally and running your script to find out. Just change
engine = On
to
engine = Off
and try it out. If you still see php info page, that means web server uses wrong php.ini.
If you use Apache, you can specify in httpd.conf which php.ini to use with
PHPIniDir "C:/path/to/your/php/dir"

Include problems in PHP

I need to turn allow_url_include On. How can I do this? I have access to .htaccess as well as php.ini.
I'm using PHP version 5.2.9
I've tried adding
php_value allow_url_include On
in .htaccess and
allow_url_include = On
in php.ini.
Both files are at the root of my website.
Is there a way to use the curl/get page function as a workaround?
Are you sure you're grabbing the right php.ini file?
If you're on a linux box, you might be grabbing the wrong one. I've seen that happen in the past. If you are indeed using Linux, open the terminal and type
which httpd
which php
Then you'll know if your pointing to the right locations.
Depending on what you are trying to use as a file to include you will need to enable both url_fopen and url_include.
The relevant php documentation entry is available here:
http://www.php.net/manual/en/filesystem.configuration.php

Categories