Asked  8 Months ago    Answers:  5   Viewed   56 times

I've just switched my scripts to a different server. On the previous server this worked flawlessly, and now that I've switched them to a different server, I can't understand the problem.

I'm not sure it would help, but here's the relevant code.

$headers = apache_request_headers();

PHP Version is: PHP 5.3.2

 Answers

28

From the docs, before the release of PHP 5.4.0:

This function is only supported when PHP is installed as an Apache module.

PHP 5.4.0 and later support this function unconditionally.

Said docs also include replacement functions that mimic the functionality of apache_request_headers by stepping through $_SERVER.

Wednesday, March 31, 2021
 
Silfverstrom
answered 8 Months ago
73

Edit: Hmm. Trying this on Windows 8 appears to generate the same error as you specified. I'm currently investigating...

My mistake (I had enabled the wrong extension_dir line). It works in Win8 just as documented below.


The following steps should be all you need to get OCI working with PHP (I've just verified this on a freshly installed Windows 2008 R2 Standard x64 virtual machine):

  • Download and extract PHP (I used C:php from php-5.6.7-nts-Win32-VC11-x86.zip).
  • Download and extract InstantClient (I used C:instantclient_12_1 from instantclient-basic-nt-12.1.0.2.0.zip).
  • Add the above paths to the system path.
  • Copy c:phpphp.ini-production to c:phpphp.ini.
  • in php.ini:
    • enabled line extension_dir = "ext".
    • enabled line extension=php_oci8_12c.dll.
  • Install Microsoft Visual C++ 2010 Runtime (x86). This is needed for the OCI8 extension.
  • Install Microsoft Visual C++ 2012 Runtime (x86). This is needed for PHP.

At this point running php --ri oci8 in a command prompt shows me the following output:

C:>php --ri oci8

oci8

OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.0.9
Revision => $Id: f5a3ee1083d1ffa6adb5143efda6eafa210b8414 $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1

Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off

Statistics =>
Active Persistent Connections => 0
Active Connections => 0

And checking for the oci_connect function:

C:>php -r "var_dump(function_exists('oci_connect'));"
bool(true)
Wednesday, March 31, 2021
 
BartmanEH
answered 8 Months ago
86

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario: http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm

Related usability ticket: http://youtrack.jetbrains.com/issue/WI-18388

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
 
ojrac
answered 8 Months ago
79

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
 
Nate
answered 5 Months ago
59

Make sure you're including the file you think you are. If your index.php page looks exactly like you've stated, then it won't return anything.

If you want to link to the same location from anywhere on the site without worrying about relative locations, then at the beginning of the file, put:

$WebsiteRoot=$_SERVER['DOCUMENT_ROOT'];

And it should work fine, provided your file would be located at http://mywebsite.com/include/testfile.php

Monday, August 23, 2021
 
user123444555621
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share