Include_path in php.ini - php

I'm trying to send mail using PEAR framework (and WAMP).
I installed PEAR and package MAIL and it is in correct folder. Problem is with include_path in php.ini.
When I checked where is my php.ini (php --ini), I have result:
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: C:\wamp\bin\php\php5.3.13\php.ini
Scan for additional .ini files in:
Additional .ini files parsed:
In C:\wamp\bin\php\php5.3.13\php.ini I set:
include_path = ".;C:\wamp\bin\php\php5.3.13\pear"
And I restarded WAMP.
After click button to send mail, I have following error:
Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\send_mail.php on line 2
Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\send_mail.php on line 2
Fatal error: Class 'Mail' not found in C:\wamp\www\send_mail.php on line 45
No idea, why include_path is here '.;C:\php\pear'.

Mike B told me to look at your phpinfo() to know exactly what ini file(s) are being used. The file was differ between cli and apache calls (php --ini is misleading).

Related

MAMP (windows) different php.ini loaded from console..why?

I try to load PHP from console (in windows) and when I run phpinfo.php the line
Loaded Configuration File => (none)
but when I run this pagin in web browser I see it:
Loaded Configuration File C:\MAMP\conf\php5.6.28\php.ini
My problem appear when I try to install symfony
Warning: readfile(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in Command line code on line 1
Warning: readfile(https://symfony.com/installer): failed to open stream: Invalid argument in Command line code on line 1
I can't able to download this file from console, can anyone help me please?

Include path not changing when I updated php.ini

I've run the following to determine which php.ini file is being used - php -i | grep 'Configuration file'.
I've then updated that php.ini file with the following - include_path = ".:/usr/share/php:/usr/local/bin
Then I restarted apache. But when I run a php script with the content - <?php var_dump(include 'non/existant/file.php'); it tells me the following:
Warning: include(non/existant/file.php): failed to open stream: No such file or directory in /var/www/debug_phpunit.php on line 3 Warning: include(): Failed opening 'non/existant/file.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/debug_phpunit.php on line 3 bool(false)
Notice the include path in the error message. My changes aren't there. Am I changing the wrong file? Could another configuration file be overwriting this?

include_path related problems in php

I have a PHP application where the autoloader is situated in /var/www/html/example.com/src/vendors/autoloader.php
var/
www/
html/
example.com
app/
vendors/
vendor_a/
example.php
vendor_b/
vendor_c/
autoloader.php
public/
In autoloader.php I have a line that requires example.php from the vedor_a/ folder.
although this works in my local virtual box running centos, php-fpm, nginx it fails to work in my vps, which has the same version of every program I am running in my localhost.
I am using php5.5.14
and I get this error when I require the above file.
Warning: require(vendor_a/example.php): failed to open stream: No such file or directory in /var/www/html/example.com/vendors/autoloader.php on line 2
Fatal error: require(): Failed opening required 'vendor_a/example.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/example.com/vendors/autoloader.php on line 2
I haven't modified anything from my php.ini where the include_path defaults to
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
I am looking more than a solution here. Because I can see the include_path looks for php/includes dir when constructs such as require, include, include_once... at-least according to the manual but I can't find a directory called php/includes so why is that setting even there?

phalcon webtools.php: not in include_path

I created a project using phalcon command line
phalcon create-project brujobs --enable-webtools
When i test the webtools page i get
Warning: require(/home/myname/phalcon-devtools/scripts/Phalcon/Web/Tools.php): failed to open stream: Permission denied in /var/www/vhost/dev.myname.be/htdocs/myname/public/webtools.php on line 22 Fatal error: require(): Failed opening required '/home/myname/phalcon-devtools/scripts/Phalcon/Web/Tools.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/vhost/dev.myname.be/htdocs/myname/public/webtools.php on line 22
I suppose the issue is that phalcon is trying to include files that are not included in my php include_path directive.
include_path .:/usr/share/pear:/usr/share/php .:/usr/share/pear:/usr/share/php
Question is: what would be the proper way to fix that? Modify the whole server's php.ini file 's include_path directive just for phalcon webtools feels wrong to me.

Enabling the cURL library for PHP using XAMPP for Windows

I am running PHP code with the following code invovled:
$ch = curl_init();
When I get to this line, the following error is returned:
Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\myfiles\API\IPVIKING_API.php on line 79
Now I've found all the answers talking about enabling the curl extension in the php.ini file, and I've done that, following this question here: How to enable curl in xampp?.
My problem is I do not have these 3 files:
C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini
I instead have 2 files called
C:\Program Files\xampp\php\php.ini-development
C:\Program Files\xampp\php\php.ini-production
I've uncommented the
;extension=php_curl.dll
line in both of them, restarted both my browser and xampp, yet it still gives me the same error. Suggestions?
Make an
<?php phpinfo(); ?>
there you can see which php.ini is loaded. In this file you uncomment the the extension line.
When there is no php.ini in this path which is in the phpinfo this should be xampp/php/php.ini then rename one of the two files
C:\Program Files\xampp\php\php.ini-development
to
C:\Program Files\xampp\php\php.ini
You should move C:\Program Files\xampp\php\php.ini-production to C:\Program Files\xampp\php\php.ini.
rename "C:\Program Files\xampp\php\php.ini-production" "C:\Program Files\xampp\php\php.ini"
And then change:
;extension=php_curl.dll
to
extension=php_curl.dll
Then restart Apache.
Some systems require two files to be copied from where PHP is installed to your WINDOWS\System32 directory:
libeay32.dll
ssleay32.dll
Update:
copy "C:\Program Files\xampp\php\php.ini" "C:\xampp\php\php.ini"
search for 'php.ini' file in
xampp\php\ directory
open php.ini
find for 'curl'
you will get line
;extension=php_curl.dll
uncomment it by removing semicolon at front of the line
extension=php_curl.dll
There is a file named php (I think this is the real php.ini) with the type as configuration settings that is the one you need to uncomment extension = php_curl.dll. You should also uncomment the .ini-development and .ini-production. Restart and both browser and apache and it should work.

Categories