4

I am using PHP 5.5.9 with Apache 2.4.7 on my PC running Ubuntu 14.04. I am trying to include a PHP script located in another web server just for some testing purposes. But I cannot seem to be able to turn allow_url_include on. I tried this:

<?php
    echo(ini_get("allow_url_include") . "<br />");

    ini_set("allow_url_include", "On");

    echo(ini_get("allow_url_include"));
?>

And it gives me this output:

0
0

I even tried this by editing the actual /etc/php5/apache2/php.ini file and set allow_url_include = Off, but still, it's the same.

How do I do it?

14
  • 1
    Try to restart apache (or webserver instance whatever) Commented Dec 24, 2014 at 17:39
  • 1
    Yes, I did it after changing the php.ini file using /etc/init.d/apache2 restart . Apache restarted, but allow_url_include still seems to be unchangeable. Commented Dec 24, 2014 at 17:40
  • 1
    search in php.ini for allow_url_include for duplicate. Commented Dec 24, 2014 at 17:41
  • 1
    From my php.ini file: allow_url_fopen = On Commented Dec 24, 2014 at 17:42
  • 1
    Nope, there are no duplicates of allow_url_include. Commented Dec 24, 2014 at 17:43

3 Answers 3

3

YES! It worked :D Right, that one line of warning caused it! I changed it to error_reporting = E_ALL in the original php.ini file and now I can change allow_url_fopen to 1. Post it as an answer and I will mark it as accepted. Thanks everyone. – lonekingc4


I saw your pastebin file with the codes you were using:

error_reporting(E_ALL)
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

Use:

error_reporting = E_ALL and not error_reporting(E_ALL) - thus, the warning

Warning: syntax error, unexpected '('...

error_reporting(E_ALL) is used when you put it in a .php file.

I.e.:

<?php 
error_reporting(E_ALL); 
ini_set('display_errors', 1);

// rest of code
  • Do that, restart Apache and you should be good to go.

Sidenote: Error reporting should only be done in staging, and never production.

Sign up to request clarification or add additional context in comments.

Comments

1

Try this:

ini_set('display_errors', true);
ini_set('safe_mode', false);
ini_set('allow_url_fopen', true);
ini_set('allow_url_include', true);
print_r(ini_get_all());


ini_set('allow_url_include', 'on');

7 Comments

Do I say the output here?
Nope, it's still like this: [allow_url_fopen] => Array ( [global_value] => 1 [local_value] => 1 [access] => 4 ) [allow_url_include] => Array ( [global_value] => 0 [local_value] => 0 [access] => 4 )
@lonekingc4 Maybe try to copy the ini file into the current dir
If you are a local server may check the firewall settings.
@Rizier123 I copied php.ini in the same directory where the script is. It's the same thing again.
|
0

It is failing because it is NOT reading your php.ini

I had the same issue trying to change php.ini on windows to no avail. You must find the correct default location:

Create a test.php file and add phpinfo(); Open the file in the browser and check for the following values:

Configuration File (php.ini) Path C:\WINDOWS Loaded Configuration File C:\WINDOWS\php.ini

When you move your php.ini file to the right location and restart php server the changes will finally take effect.

Enjoy!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.