Include problems in PHP - 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

Related

PHP include no longer working with non standard file type

I'm setting up a new web server with CentOS 7.4. My old server uses CentOS 6.
Several webpages use php include with arbitrary file extensions.
This still works:
include '../../includes/header.php';
This no longer works:
include 'nav.inc';
PHP version is -5.4.16-46.el7
There is nothing in the error_log.
Can someone help with what I need to configure in php.ini or the httpd.conf file?
Thanks
I had set short_open_tag = On in php.ini, but for some reason it was still set to off. Setting it back to On fixed the problem.
try this i hope it will help:
use php extension too like :nav.inc.php
include_once('nav.inc.php');
Check your include path in php.ini. The default is include_path = ".:/usr/share/php", first looking into the current work directory ., then further directories of shared libraries.
If you cannot or do not want to administrate the system settings, you can use the set_include_path or ini_set function from within PHP as well or a php.ini on directory basis or php_value in .htaccess.

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

PHP is working even without php.ini

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.

Loading PHP Extensions using Plesk

I am trying to load the php_memcache.dll extension using the Plesk Additional Directives section under the PHP Settings for a domain, subscription or subdomain. No matter what I do, I cannot get Plesk to load the extension!
The only way I can load the extension into PHP is by manually editing the php.ini, which is a dirty fix as I will need to edit this each time the server is updated as the php.ini gets overwritten each time!
The php_memcache.dll is definitely in the extensions directory referenced in the phpinfo(), this is proven by the fact that I can load the extension successfully by entering it into the php.ini manually.
I am pretty confident this is a bug, but just wanted to see if anybody else has had any similar issues?
The bug seems to be the description implying that it is possible when it really is not.
In this page: http://download1.parallels.com/Plesk/PP11/11.5/Doc/en-US/online/plesk-administrator-guide/index.htm?fileName=69696.htm it says that additional directives can take any setting that is listed as PHP_INI_USER and PHP_INI_ALL in this page: http://php.net/manual/en/ini.list.php.
In that page extension is listed as php.ini only, so it will not work from the additional directives option.

Categories