0

I have this line of code in my php file :

require_once 'HTTP/Request2.php'; 


I have installed pear and the installation was successful and I have Request2.php file on my HTTP directory of pear on my wamp. I have put my php file on my www folder but when I run it I still get this message :

Warning: require_once(HTTP/Request2.php): failed to open stream: No such file or directory in C:\wamp\www\php\phptest.php on line 3

I don't get why I still get this error , is there a mistake in addressing the file or something else. I'll appreciate if someone can help me with this.
thanks very much

m0j1
  • 4,067
  • 8
  • 31
  • 54
  • 1
    "I have `request2.php` on my `http` directory" but the path you are requesting is `HTTP/Request2.php`. File names are case sensitive. – Lucky Soni Jun 30 '14 at 22:27
  • It was the mistake on the question , I've done it right on the system. edited to the correct ones. – m0j1 Jun 30 '14 at 22:32
  • try require_once('../HTTP/Request2.php'); the ".." goes back one directory – J-Dizzle Jun 30 '14 at 22:34
  • changed to ../HTTP/Request2.php and I still get the error. – m0j1 Jun 30 '14 at 22:37
  • is there a file `C:/wamp/www/php/HTTP/Request2.php` here? – Lucky Soni Jun 30 '14 at 22:38
  • No Requet2.php is in "C:\wamp\bin\php\php5.5.12\pear\HTTP" – m0j1 Jun 30 '14 at 22:48
  • 1
    You need to check your include path - http://stackoverflow.com/questions/8112866/setup-include-path-for-pear-on-wamp http://pear.php.net/manual/en/installation.checking.php#installation.checking.cli.modifyingphpini – madebydavid Jun 30 '14 at 22:59
  • The pear folder is already added to the php.ini file. include_path=".;C:\wamp\bin\php\php5.5.12\pear – m0j1 Jun 30 '14 at 23:56

1 Answers1

0

If you are running a script out of C:\wamp\www\php\phptest.php then I am assuming you are using the CLI i.e. running a script from the command line.

The CLI gets its php.ini file from c:\wamp\bin\php\php5.5.12\php.ini i.e. not the same php.ini file that is edited when you use the wampmanager menu system to edit php.ini

Make the change to your include_path in c:\wamp\bin\php\php5.5.12\php.ini and see if that solves your problems.

You can ask PHP where it is looking for its ini file by doing this:-

C:\>d:\wamp\bin\php\php5.5.12\php --ini

Which should show something like this

Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\wamp\bin\php\php5.5.12\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

P.S. Dont be tempted to put a php.ini file in the C:\Windows folder.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • No , I'm not trying to run the script from command line. I did "php --ini" and it returned the same result as you've mentioned. here's the php.ini file : https://app.box.com/s/dldofu4yhq3izdchc2zj – m0j1 Jul 01 '14 at 11:10
  • You could try removing the `HTTP` from `include_path=".;C:\wamp\bin\php\php5.5.12\pear\HTTP"` that will probably fix it. – RiggsFolly Jul 01 '14 at 11:16
  • Try creating a file with just ` – madebydavid Jul 02 '14 at 12:16