Hướng dẫn include_path php ini

I've searched all over the place and can't seem to find an answer for this. I'm trying to set an include path in the php.ini file of my local wamp server. I currently don't understand one of two things:

  1. What to put in the quotes of the include path setting itself.
    For example, if I wanted to add C:\wamp\www as an include path, would it be
    include_path = ".;C:\wamp\www\"?
  2. Where to put the include path line. Can I put it anywhere, or do I have to put it in a specific place?

Some common errors I've read about in my research that I've checked.

  • I'm editing the php.ini file located at C:\wamp\bin\php\php5.3.8
  • I've restarted the server after I've made my changes and have checked if it had updated using the phpinfo[] function.

UPDATE
This is currently what I have, but it still doesn't work.

; Windows: "\path2;\path2"
include_path = ".;C:\php\pear;C:\wamp\www"

asked Feb 18, 2012 at 23:23

Kevin PeiKevin Pei

5,6697 gold badges35 silver badges52 bronze badges

4

This all depends on what you are trying to accomplish. Personally, I don't edit the php.ini file directly for setting include_paths, rather I use the following construct, in code:

// This will append whichever path you would like to the current include path
// PHP is smart enough to convert / with \ if on a Windows box
// If not you can replace / with DIRECTORY_SEPARATOR
set_include_path[get_include_path[] . PATH_SEPARATOR . 'my/custom/path'];

-- Edit --

Chances are there may be multiple copies of php.ini on your system, and that you are not editing the one that is being used by PHP.

cwallenpoole

77.3k26 gold badges125 silver badges163 bronze badges

answered Feb 18, 2012 at 23:32

Mike PurcellMike Purcell

19.5k10 gold badges50 silver badges86 bronze badges

3

The php.ini file will have include_path already in it, but commented out, that is where you should put it, by uncommenting it. It also has examples for windows. It will look like this, just remove the semicolon preceding "include_path"

; Windows: "\path2;\path2"
;include_path = ".;c:\php\includes"

answered Feb 18, 2012 at 23:27

thenetimpthenetimp

9,2275 gold badges28 silver badges40 bronze badges

4

Hit this link when I was trying to debug why the include_path in my php.ini file was not taking effect. I am talking about my ubuntu setup with a bitnami api. The solution was to restart the php-fpm using ./ctlscript properly. Was restarting only apache but had to restart php-fpm as well.

Hopefully helps somebody trying it in ubuntu with a bitnami lampstack.

answered Jan 9, 2014 at 6:32

ramram

391 gold badge1 silver badge5 bronze badges

If you discover this thread and you're using a current version of WAMPServer you might run into the issue I had where you edit the php.ini referenced in the phpinfo[] report, but it doesn't change the includes path. Doing a search of the WAMP directory showed 2 DLL's [both named php5ts.dll in the php and apache dirs] where the include path is specified. Use the Bitnami WAMP environment instead [//bitnami.com/stack/wamp/installer]. GO PATS!

answered Nov 12, 2015 at 22:40

Ginja NinjaGinja Ninja

3951 gold badge7 silver badges15 bronze badges

Not the answer you're looking for? Browse other questions tagged php include-path or ask your own question.

Chủ Đề