Link to home
Start Free TrialLog in
Avatar of geoff_austin
geoff_austin

asked on

Cannot load php.ini

Dear Experts,

I have a Windows 2003 Server with PHP 5.2.6 for Apache installed (I installed using the MSI file).  I have recently installed PHP for IIS on the same server.  I used the zip file, which I extracted to c:\PHP

PHP now works under IIS, but to make my site work I need to enable CURL, which means editing the php.ini file.  I checked phpinfo (attached), which told me it was looking for php.ini under c:\windows.  There was no file there, so I copied php.ini.recommended from c:\php to c:\windows and renamed it to php.ini, then made the necessary change to enable CURL.  However after restarting IIS and the server PHP will no work.  When I rename the php.ini file and restart the server it works again.

I have attached my php.ini file to this question if it will help.

I'm really new to PHP so assume I know nothing and you won't be far off.

Cheers,
Geoff
phpinfo.jpg
php.txt
Avatar of AdamRobinson
AdamRobinson

This may be helpful, from http://www.php.net/configuration

"
* If you are e.g. using MySQL you will have to edit php.ini. In order for it to be found, you must set the PHPRC system environment variable or the registry entry. Note that if you edit the registry using regedit.exe, the PHP key should be placed under the [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node] key. This happens automatically if you set it using a 32 bit legacy application.
"
Strictly a guess, but IIRC you have to do something extra at install time to put in CURL support.  Worth a check, maybe.  HTH, ~Ray
Avatar of geoff_austin

ASKER

AdamRobinson - Thanks for your reply.  I have read through that page.  It says PHP will automatically look for php.ini under c:\windows, so I shouldn't need to set any registry keys should I?

Ray_Paseur - Thanks for your reply.  I followed the steps in this link to install PHP for Apache:-

http://www.iis-aid.com/articles/how_to_guides/installing_php_5_on_iis_in_5_simple_steps

Couldn't see anything in there about CURL.  However I think the problem is more general than that.  When there is no php.ini file PHP runs OK.  However, when I put a php.ini file in c:\windows and restart IIS PHP will not run at all.

Thanks, Geoff.
I use PHP4, 5 and 6 on my machine.

To deal with different INI files I have the following Registry entries.

Rename and load.

Restart web service.

You can also check via the command line ...

\php\php --ini

My output for that command is ...

Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\PHP_INI\PHP5\php-cli.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)


Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\PHP_INI"
 
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5]
"IniFilePath"="C:\\PHP_INI\\PHP5"
 
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP\6]
"IniFilePath"="C:\\PHP_INI\\PHP6"

Open in new window

php-ini.reg.drop.txt
Once you've got the CLI version pointing to the right ini file (I put NOTHING of PHP in the windows folder), then we can see what modules it knows about ...

php -m

My output is ...

[PHP Modules]
bcmath
bz2
calendar
com_dotnet
ctype
curl
date
dom
ereg
filter
ftp
gd
haru
hash
iconv
json
ldap
libxml
lzf
mhash
mysqli
mysqlnd
odbc
pcre
PDO
Phar
printer
Reflection
session
SimpleXML
soap
sockets
SPL
SQLite
standard
tidy
tokenizer
wddx
win32service
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]
Zend Extension Manager




If no curl, then edit the ini file (which I hope you realised needs to be in C:\PHP_INI\PHP5) and look for ...

extension=php_curl.dll


If you have ...

;extension=php_curl.dll

then remove the leading ;

If nothing at all, then look for ...

; Dynamic Extensions ;

and add ...

extension=php_curl.dll

somewhere underneath.

For curl to work (from the manual http://docs.php.net/manual/en/curl.installation.php) ...

Note: Note to Win32 Users
In order to enable this module on a Windows environment, libeay32.dll and ssleay32.dll must be present in your PATH. You don't need libcurl.dll from the cURL site.

These files are supplied as part of PHP.

I would add C:\PHP5 to your path. If you already have libeay32.dll on your machine, it may not be the same version and that could be an issue if you upgrade (or not - depending upon what breaks).
Thanks for all your help.  

I haven't had a chance to look at this today.  I will spend some time on it tomorrow and post my results on here.

Cheers, Geoff.
RQuadling

Currently the only registry entries I have HLM\SOFTWARE\PHP relate to my Apache install:-

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"ApacheDir"="C:\Program Files\Apache Software Foundation\Apache2.2\conf\"

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"InstallDir"="C:\Program Files\PHP\"

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"WebServerType"="apache22"

I added the following:-

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\PHP"

and restarted IIS.  Now PHP is not running.

Executing c:\php\php --ini from the command line I get:-

C:\>c:\php\php --ini
PHP Warning:  PHP Startup: Unable to load dynamic library './php_curl.dll' - The
 specified module could not be found.
 in Unknown on line 0
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

I can see the dll file under here:-

C:\PHP\ext\php_curl.dll

What else do I need to do?  (apologies for newbiness)

Cheers, Geoff
Ok.

So this is telling me that the php.ini file is recognised from the Registry ...

Loaded Configuration File:         C:\php\php.ini



So, the next thing to do is to edit this ini file.

Look for the line starting with ...

extension_dir

Mine is ...

extension_dir = "C:\PHP5\ext"


Yours looks like it should be ...

extension_dir = "C:\PHP\ext"


Save the file.


At the command line type ....

php --ini

and then

php -v

In my php.ini file the extension directory was blank.  I have changed it to:-

extension_dir = "C:\PHP\ext"

Running those commands:-

C:\>c:\php\php --ini
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

C:\>c:\php\php -v
PHP 5.2.6 (cli) (built: May  2 2008 18:02:07)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

PHP doesn't seem to be running still.

Thanks again for your help.
EDIT: Further to my post above, I should clarify the situation.

The page that I am trying to get working (which uses CURL) is not working.

However, I can browse /phpinfo.php (results attached).  Does this mean PHP is working?

Cheers, Geoff
phpinfo.pdf
It means the __CLI__ installation is finding the INI file and not giving any errors.

I see from the PDF you've supplied, that the Apache installation of PHP is also finding the INI file AND that curl is loaded.

So, this means the issue is now with Curl and not the INI file.

So. What errors does your code create?

If you have suppressed errors, then unsuppress them.

<?php
error_reporting(E_ALL); // Report EVERYTHING.
ini_set('display_errors', 1); // Display the errors as part of the output.
set_time_limit(0); // Don't timeout after the default 30 seconds.
// Carry on with your code.
I also see that you have 2 PHP paths. What is in C:\Program Files\PHP ?

If it is not required, remove it.

Also, look in C:\PHP for any DLL files. See if you have any of the same file names anywhere else in the path.

I've attached my PHP script called WhereIs which you can run from the command line to help.

I have a directory called C:\Utils, so ...

DEL C:\PHPDLLs.log
for %f in (C:\php\*.dll) do C:\php\php.exe -n C:\Utils\WhereIs.php %~nf.*>> C:\PHPDLLs.log

My log file is ...

WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ============================
C:\PHP5   fdftk.dll 2008-06-12 417,792


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= =============================
C:\PHP5   fribidi.dll 2008-03-04 90,112


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ============================
C:\PHP5   gds32.dll 2008-06-12 346,624


WhereIs : (C) UK 2005 Richard Quadling

Directory           Found (Date and Size)
=================== =================================
C:\PHP5             libeay32.dll 2008-06-12 1,097,728
c:\ruby\bin         libeay32.dll 2007-03-16 1,077,248
C:\WINDOWS\system32 libeay32.dll 2004-12-07 638,976  


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ================================
C:\PHP5   libmcrypt.dll 2008-06-12 166,912


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ===============================
C:\PHP5   libmhash.dll 2008-06-12 165,643


WhereIs : (C) UK 2005 Richard Quadling

Directory                                   Found (Date and Size)
=========================================== =================================
C:\PHP5                                     libmysql.dll 2008-06-12 2,076,672
D:\Program Files\MySQL\MySQL Server 5.0\bin libmysql.dll 2008-01-18 2,076,672
C:\Program Files\CVSNT\                     libmysql.dll 2005-10-20 233,472  


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ============================
C:\PHP5   libpq.dll 2008-08-08 464,172


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= =================================
C:\PHP5   libswish-e.dll 2008-07-28 385,024


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ==========================
C:\PHP5   msql.dll 2008-07-28 57,344


WhereIs : (C) UK 2005 Richard Quadling

Directory           Found (Date and Size)
=================== ===============================
C:\PHP5             ntwdblib.dll 2008-06-12 278,800
C:\WINDOWS\system32 ntwdblib.dll 2005-05-04 290,816


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ================================
C:\PHP5   php5apache.dll 2008-06-12 36,924


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= =================================
C:\PHP5   php5apache2.dll 2008-06-12 36,925


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ===================================
C:\PHP5   php5apache2_2.dll 2008-06-12 36,927


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ==========================================
C:\PHP5   php5apache2_2_filter.dll 2008-03-04 36,934


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ========================================
C:\PHP5   php5apache2_filter.dll 2008-03-04 36,932


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ======================================
C:\PHP5   php5apache_hooks.dll 2008-06-12 57,410


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ===============================
C:\PHP5   php5isapi.dll 2008-06-12 28,731


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ===============================
C:\PHP5   php5nsapi.dll 2008-06-12 28,731


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ================================
C:\PHP5   php5pi3web.dll 2008-06-12 24,636


WhereIs : (C) UK 2005 Richard Quadling

Directory Found (Date and Size)
========= ===============================
C:\PHP5   php5ts.dll 2008-06-12 5,300,280


WhereIs : (C) UK 2005 Richard Quadling

Directory   Found (Date and Size)
=========== ===============================
C:\PHP5     ssleay32.dll 2008-06-12 204,800
c:\ruby\bin ssleay32.dll 2007-03-16 200,704





As you can see, there are sometimes many instances of a file (take the last one above).

Find duplicates and resolve them. Most likely the ones in PHP are NOT getting loaded as they are present in the path.

Putting C:\PHP in the path first should help resolve that.

If you are getting PHP errors specific to Curl, ask another question as you'll get more experts looking at a new Curl question than an old php.ini question.

Regards,

Richard.
<?php
/* $Id: WhereIs.php,v 1.0.10 2008/07/18 15:02:07 RichardQ $ */
 
if (!function_exists('fnmatch'))
	{
	function fnmatch($pattern, $string)
		{
		for ($op = 0, $npattern = '', $n = 0, $l = strlen($pattern); $n < $l; $n++)
			{
			switch ($c = $pattern[$n])
				{
				case '\\' :
					$npattern .= '\\' . @$pattern[++$n];
					break;
				case '.' :
				case '+' :
				case '^' :
				case '$' :
				case '(' :
				case ')' :
				case '{' :
				case '}' :
				case '=' :
				case '!' :
				case '<' :
				case '>' :
				case '|':
					$npattern .= '\\' . $c;
					break;
				case '?' :
				case '*' :
					$npattern .= '.' . $c;
					break;
				case '[' :
				case ']' :
				default:
					$npattern .= $c;
					if ($c == '[')
						{
						$op++;
						}
					else if ($c == ']')
						{
						if ($op == 0)
							{
							return false;
							}
						$op--;
						}
					break;
				}
			}
		if ($op != 0)
			{
			return false;
			}
 
		return preg_match('/^' . $npattern . '$/i', $string);
		}
	}
 
// Get the list of directories in the PATH.
if (array_key_exists('PATH', $_ENV))
	{
	$aPaths = array_merge(array('.'), explode(';', $_ENV['PATH']));
	}
elseif (array_key_exists('Path', $_ENV))
	{
	$aPaths = array_merge(array('.'), explode(';', $_ENV['Path']));
	}
else
	{
	$aPaths = array('.');
	}
 
// List of files found.
$aFoundFiles = array();
 
// Get the list of extensions allowed to be autoexecuted.
$aExtensions = explode(';', $_ENV['PATHEXT']);
 
// Maximum path length.
$iMaxPathLen = 0;
 
// Maximum filename length.
$iMaxFileLen = 0;
 
// Maximum formatted file size.
$iMaxFileSize = 0;
 
$bWildcards = ((strpos($argv[1], '*') !== False) || (strpos($argv[1], '?') !== False));
 
// Run through the paths.
foreach($aPaths as $iPath => $sPath)
	{
	// Dont't bother with blank paths.
	if ((strlen($sPath) == 0) || !is_dir($sPath))
		{
		continue;
		}
 
	// Look further if we supplied a filename.
	if (isset($argv[1]) && strlen(trim($argv[1])) > 0)
		{
		// Are we using wildcards.
		if ($bWildcards)
			{
			foreach(new DirectoryIterator($sPath) as $obj_File)
				{
				if (fnmatch($argv[1], $obj_File))
					{
					// Record the maximum path length.
					$iMaxPathLen = max(9, strlen($sPath), $iMaxPathLen);
 
					// Record the maximum file length.
					$iMaxFileLen = max(strlen($obj_File), $iMaxFileLen);
 
					// Get the statistics about the file.
					$aFoundFiles[$sPath][$obj_File->getFilename()] = stat($obj_File->getPathname());
 
					// Record the maximum filesize length.
					$iMaxFileSize = max(strlen(number_format($aFoundFiles[$sPath][$obj_File->getFilename()]['size'], 0)), $iMaxFileSize);
					}
				}
			}
		else
			{
			// Use each extension to find the file.
			foreach($aExtensions as $iExtension => $sExtension)
				{
				// Don't bother with blank extensions
				if (strlen($sExtension) == 0)
					{
					continue;
					}
				// Build the filename.
				$sFileName = $sPath . '/' . $argv[1] . $sExtension;
 
				// Does the file exist?
				if (file_exists($sFileName))
					{
					// Record the maximum path length.
					$iMaxPathLen = max(9, strlen($sPath), $iMaxPathLen);
 
					// Record the maximum file length.
					$iMaxFileLen = max(strlen($argv[1] . $sExtension), $iMaxFileLen);
 
					// Get the statistics about the file.
					$aFoundFiles[$sPath][$argv[1] . $sExtension] = stat($sFileName);
 
					// Record the maximum filesize length.
					$iMaxFileSize = max(strlen(number_format($aFoundFiles[$sPath][$argv[1] . $sExtension]['size'], 0)), $iMaxFileSize);
					}
				}
			}
		}
	}
 
// Build headers.
$sDirectoryHeading = 'Directory' . str_repeat(' ', max(0,$iMaxPathLen - 9));
$sDirectoryUnderline = str_repeat('=', max(9, $iMaxPathLen));
$sFoundHeading = "Found (Date and Size)";
$sFoundUnderline = str_repeat("=", max(21, $iMaxFileLen + $iMaxFileSize + 12));
 
// Output headers.
echo "WhereIs : (C) UK 2005 Richard Quadling\n\n{$sDirectoryHeading} {$sFoundHeading}\n{$sDirectoryUnderline} {$sFoundUnderline}\n";
 
// Output found files.
foreach($aFoundFiles as $sPath => $aFiles)
	{
	$sPathOutput = $sPath;
	foreach($aFiles as $sFileName => $aFileStat)
		{
		echo
			$sPathOutput . str_repeat(' ', $iMaxPathLen - strlen($sPathOutput)) . ' ' . 
			$sFileName . str_repeat(' ', $iMaxFileLen - strlen($sFileName)) . ' ' . 
			date('Y-m-d', $aFileStat['mtime']) . ' '
			 .
			str_pad(number_format($aFileStat['size'], 0), $iMaxFileSize, ' ') ."\n";
		$sPathOutput = '';
		}
	}

Open in new window

RQuadling:-  I have PHP for Apache already installed on this server (under c:\program files\php).  I am trying to run PHP for IIS on the same server.  I have no previous experience of PHP, so this is all very new to me.

The page I am trying to get working is a gallery page using the Flickr API.  With the php.ini file present, the page does not give you any error message - See "PHP not working"

When I rename php.ini to php.something and restart IIS, the page actually renders but displays a CURL error message - See "PHP working"

Does that make more sense?
PHP-working.jpg
PHP-not-working.jpg
Ha ha ha !!!! Do you take 2 web servers into the shower? (paraphrasing Wash-and-Go Shampoo+Conditioner)

Why?

How are you differentiating between them (by IP or port ? )

Only one will communicate on port 80. So unless you are disabling Apache first, you are probably finding that only one of them is actually running.

I use neither on Windows (sadly Sambar Server is now defunct).



At the command prompt, can you type ...

C:\php\php -m

Is curl present?



And can you show us the code in D:\websites\Intranet\gallery\setUp\preferences.php?

Ha ha.  Very good.  I did actually mention this fact in my original question, but not to worry.

The reason why is that I have a test version of my company website running on this server which requires apache.  However I have a half-written Intranet that runs under IIS, and this gallery application requires IIS + PHP.  However if I'd have known it was going to be this difficult I would have moved my Intranet to a different server, or given up on my PHP gallery application.

I am differentiating by port.  Apache runs on 8081.  IIS has port 80.

When I run that command with php.ini file present CURL is included in the list:-

C:\>C:\php\php -m
[PHP Modules]
bcmath
calendar
com_dotnet
ctype
curl
date
dom
filter
ftp
hash
iconv
json
libxml
odbc
pcre
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zlib

[Zend Modules]

I have attached preferences.php as a text file.

Cheers, Geoff
preferences.txt
Ok. Can you put this php script in your IIS installation and run it via your browser.


<html>
<head>
<title>Show extensions available and the cURL function list.</title>
</head>
<body>
<h1>Extensions loaded</h1>
<pre><?php print_r(get_loaded_extensions()); ?></pre>
<h1>Extensions loaded</h1>
<pre><?php print_r(get_extension_funcs('curl')); ?></pre>
</body>
</html>

My output is below.


Sorry this is taking so long. I need to be careful about what I tell you to change, so need the info first.


Extensions loaded
 
Array
(
    [0] => bcmath
    [1] => calendar
    [2] => com_dotnet
    [3] => ctype
    [4] => session
    [5] => ereg
    [6] => filter
    [7] => ftp
    [8] => hash
    [9] => iconv
    [10] => json
    [11] => mysqlnd
    [12] => odbc
    [13] => pcre
    [14] => Reflection
    [15] => date
    [16] => libxml
    [17] => standard
    [18] => tokenizer
    [19] => zip
    [20] => zlib
    [21] => SimpleXML
    [22] => dom
    [23] => SPL
    [24] => Phar
    [25] => wddx
    [26] => xml
    [27] => xmlreader
    [28] => xmlwriter
    [29] => ISAPI
    [30] => bz2
    [31] => curl
    [32] => gd
    [33] => ldap
    [34] => lzf
    [35] => mhash
    [36] => mysqli
    [37] => PDO
    [38] => soap
    [39] => tidy
    [40] => win32service
    [41] => xmlrpc
    [42] => xsl
)
 
Extensions loaded
 
Array
(
    [0] => curl_init
    [1] => curl_copy_handle
    [2] => curl_version
    [3] => curl_setopt
    [4] => curl_setopt_array
    [5] => curl_exec
    [6] => curl_getinfo
    [7] => curl_error
    [8] => curl_errno
    [9] => curl_close
    [10] => curl_multi_init
    [11] => curl_multi_add_handle
    [12] => curl_multi_remove_handle
    [13] => curl_multi_select
    [14] => curl_multi_exec
    [15] => curl_multi_getcontent
    [16] => curl_multi_info_read
    [17] => curl_multi_close
)

Open in new window

Oops. A cosmetic change. The second ...
<h1>Extensions loaded</h1>
should be
<h1>cURL functions available</h1>
Also, use <?php and NOT <? for your php tag.

<? is the short_open_tag and may be disabled by your setup.

<?php will ALWAYS work - there is no way to disable it.
This is what I get:-
Extensions loaded
 
Array
(
    [0] => bcmath
    [1] => calendar
    [2] => com_dotnet
    [3] => ctype
    [4] => session
    [5] => filter
    [6] => ftp
    [7] => hash
    [8] => iconv
    [9] => json
    [10] => odbc
    [11] => pcre
    [12] => Reflection
    [13] => date
    [14] => libxml
    [15] => standard
    [16] => tokenizer
    [17] => zlib
    [18] => SimpleXML
    [19] => dom
    [20] => SPL
    [21] => wddx
    [22] => xml
    [23] => xmlreader
    [24] => xmlwriter
    [25] => ISAPI
    [26] => curl
)
 
cURL functions available
 
Array
(
    [0] => curl_init
    [1] => curl_copy_handle
    [2] => curl_version
    [3] => curl_setopt
    [4] => curl_setopt_array
    [5] => curl_exec
    [6] => curl_getinfo
    [7] => curl_error
    [8] => curl_errno
    [9] => curl_close
    [10] => curl_multi_init
    [11] => curl_multi_add_handle
    [12] => curl_multi_remove_handle
    [13] => curl_multi_select
    [14] => curl_multi_exec
    [15] => curl_multi_getcontent
    [16] => curl_multi_info_read
    [17] => curl_multi_close
)

Open in new window

So, curl is installed and the function is available.

Hmm.

Add this debug to function getFileContents()


function getFileContents($url) {
	if (function_exists('curl_init')){
 
	$ch = curl_init();
	$timeout = 0; // set to 0 for no timeout
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_HEADER, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
	$file_contents = curl_exec($ch);
	curl_close($ch);
	return $file_contents;
 
	} else {
	return 'curl_init() does not exist';
	}
}

Open in new window

You could not use curl and use a context (maybe - I've not done much with contexts, but they seem to be just as good as curl).

Actually, in studying the options you are setting, wouldn't ...

file_get_contents($url);

be enough?

Do you use the headers?

Also, file_get_contents seems to follow HTTP 302's (document moved).
I got those results with my php.ini file in place.  In this situation my gallery app doesn't render at all (see PHP not working.jpg above).

If I rename php.ini to php.somethingelse and browse your script again it shows me that cURL is unavailable.

I'm sorry but I don't understand your last 2 posts.  Like I say I'm new to PHP and curl.  Perhaps I should just give up and move my Intranet to a different server and use the PHP installer to set it up.  I'm starting to lose the will to live to be honest!

Thanks for your help anyways.  It's much appreciated.
Extensions loaded
 
Array
(
    [0] => bcmath
    [1] => calendar
    [2] => com_dotnet
    [3] => ctype
    [4] => session
    [5] => filter
    [6] => ftp
    [7] => hash
    [8] => iconv
    [9] => json
    [10] => odbc
    [11] => pcre
    [12] => Reflection
    [13] => date
    [14] => libxml
    [15] => standard
    [16] => tokenizer
    [17] => zlib
    [18] => SimpleXML
    [19] => dom
    [20] => SPL
    [21] => wddx
    [22] => xml
    [23] => xmlreader
    [24] => xmlwriter
    [25] => ISAPI
)
 
cURL functions available

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh. On the docs page ...

If php-SAPI.ini exists (where SAPI is used SAPI, so the filename is e.g. php-cli.ini or php-apache.ini), it's used instead of php.ini. SAPI name can be determined by php_sapi_name().

Like I said earlier, maybe using the right INI file for your sapi (server) could fix this.
RQuadling:-

With the php.ini file present in c:\php cURL is available (hence the first set of results).  However my page doesn't render at all (see http://filedb.experts-exchange.com/incoming/2008/09_w36/55861/PHP-not-working.jpg)

When I rename my php.ini file to php.recommended and restart IIS, cURL is no longer available, and in that situation my page renders, but gives me an error message about cURL (see http://filedb.experts-exchange.com/incoming/2008/09_w36/55860/PHP-working.jpg).

I'm going to close this question now because we're not getting anywhere.  You haven't fixed my problem but you've given me lots of useful info so I'm going to reward you the points.

Thanks for your time.
I hadn't finished.

1 - Use <?php in your code as <? is being ignored.
2 - Use C:\php\php.ini

All will then be OK.

php.recommended isn't used. It is just a suggestion of what your php.ini could look like.
I know php.recommended isn't used.  That's the whole point.  Whenever I have a valid php.ini file in place my page does not render.  That is what I don't understand and that is what I wanted to be fixed.

I'm going to try an alternative solution, e.g. moving my Intranet to a different server.

Thanks again for your help.
Really there is no need. You are VERY VERY close to working.

The fact that you CAN get php to run means your webserver IS aware.

It is just using the wrong ini file. Probably using the default builtin one - not an external physical file.

So. The next step is to see what can possibly make PHP fail to run.

It is a simple setting.

Look in the C:\php\php.ini file for ...

short_open_tag = Off

This is one of the first settings.

Most likely yours is set like mine to off.

Turn it on (but read about it first so you can fix your code and then turn it off again).

Yes you're right!

The page is now rendering, and there is no error message about cURL!  Thank God for that!

Why do I need to turn it off again?  Is there some issue around security?

Thanks a lot - You have restored my faith in the world.
<? is used in xml, so if you are trying to create an XML file in PHP and you are using short open tags, when the php interpreter sees <? it can't easily determine if this is for PHP or for XML.

And as the default is to turn off short_open_tags, simply change your code.

It will work everywhere.

Just because you CAN drive on the wrong side of the road, it doesn't mean you should!
If you feel an upgrade to the grade is warranted, then you will need to ask in community support for that (fishing!).
I'm happy to put a good word in, if you tell me how.

You've been very patient - More patient than me.