PHP not working?

Page 1 of 1

8 Replies - 1851 Views - Last Post: 23 November 2010 - 03:02 PM

#1 chance528   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-September 10

PHP not working?

Posted 21 November 2010 - 03:24 PM

Hi everyone,

I'm having a problem with my PHP installation. When I try to run a PHP file in my browser, I get an HTML page with broken PHP code, or sometimes just a blank page. When I try to run php.exe, it says OCI.dll can not be found.

Here's the question: is the problem with the browser or is it with PHP? or maybe just the code?

index.php
<?php
	function connect()
	{
		$dbconn = mysql_connect('localhost', 'root', 'chance');
		$db = mysql_select_db('db', $dbconn);
		if (!db) die(mysql.error());
	}
	echo '<html>\n<head>\n';
	echo '<style type=text/css>\n\tbody\n\t\tfont-family: ';
	echo 'sans-serif;\n\t\tfont-size: 13pt;\n\t}\n</style>\n';
	
	$p = $_GET['p'];
	
	if ($p == 'home') $page = 'Home';
	else if ($p == 'dload') $page = 'Download';
	else if ($p == 'forum') $page = 'Forums';
	else if ($p == 'about') $page = 'About';
	
	echo '<title>';
	echo htmlspecialchars('Chance\'s Site');
	echo ' | $page</title>';
	
	connect();
	
	echo 'You are at the '.$page.' page.\n';
	echo '</body>\n</html>';
?>



Thanks in advance. :smile2:

Is This A Good Question/Topic? 0
  • +

Replies To: PHP not working?

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6260
  • View blog
  • Posts: 24,030
  • Joined: 23-August 08

Re: PHP not working?

Posted 21 November 2010 - 05:38 PM

OCI.DLL appears to be an Oracle DLL. Are you using Oracle?

Please describe your server setup. Where it's looking for a DLL, is it safe to assume it's on Windows? Did you use one of the all-inclusive packages like WampServer or XAMPP, or is this a piecemeal installation?

This might also be relevant.
Was This Post Helpful? 0
  • +
  • -

#3 chance528   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-September 10

Re: PHP not working?

Posted 21 November 2010 - 06:57 PM

View PostJackOfAllTrades, on 21 November 2010 - 06:38 PM, said:

OCI.DLL appears to be an Oracle DLL. Are you using Oracle?

Please describe your server setup. Where it's looking for a DLL, is it safe to assume it's on Windows? Did you use one of the all-inclusive packages like WampServer or XAMPP, or is this a piecemeal installation?

This might also be relevant.


Right. I'm using MySQL on Windows 7... I just used individual installations, for both PHP and MySQL.

I've read the link you posted, I think that didn't help. Is php.ini read-only? I tried to change it.

php.ini:
...
[PHP_PDO_MYSQL]
extension=php_pdo_mysql.dll
; [PHP_PDO_OCI]
; extension=php_pdo_oci.dll
[PHP_PDO_ODBC]
extension=php_pdo_odbc.dll
...


notepad++:
Save Failed: Please check whether if the file is opened in another program

This post has been edited by chance528: 21 November 2010 - 06:59 PM

Was This Post Helpful? 0
  • +
  • -

#4 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: PHP not working?

Posted 22 November 2010 - 08:39 AM

View Postchance528, on 21 November 2010 - 07:57 PM, said:

View PostJackOfAllTrades, on 21 November 2010 - 06:38 PM, said:

OCI.DLL appears to be an Oracle DLL. Are you using Oracle?

Right. I'm using MySQL on Windows 7... I just used individual installations, for both PHP and MySQL.

Uhm.

MySql is not Oracle.
Was This Post Helpful? 0
  • +
  • -

#5 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: PHP not working?

Posted 22 November 2010 - 09:40 AM

View Postchance528, on 22 November 2010 - 01:57 AM, said:

I've read the link you posted, I think that didn't help. Is php.ini read-only? I tried to change it.

Right click the Notepad icon and select "Run as Administrator". Then use that window to edit the file.

P.S.
If I remember correctly, Notepad++ needs to be closed completely if you intend to use this on it.

This post has been edited by Atli: 22 November 2010 - 09:42 AM

Was This Post Helpful? 0
  • +
  • -

#6 chance528   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-September 10

Re: PHP not working?

Posted 22 November 2010 - 04:12 PM

no2pencil: I know that. I said "Right." on JackOfAllTrades assuming that I'm running Windows.

I've tried what Atli said..
Editing worked, but <?php echo $php != $working; ?>
It displays the same message.

The program can't start because OCI.dll is missing from your computer. Try reinstalling the program to fix this problem.

During the first try, the message showed 3 times. After editing, it showed 2 times.

Did that help?

This post has been edited by chance528: 22 November 2010 - 04:12 PM

Was This Post Helpful? 0
  • +
  • -

#7 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: PHP not working?

Posted 23 November 2010 - 01:43 PM

Is there any reference to "OCI.dll" in your PHP.ini file?

You say you get this when running a php script in your browser. Which HTTP server are you using, and how did you install PHP on that server? (That is, did you let the PHP installer configure the HTTP server to use PHP.)

Exact version numbers are helpful.
Was This Post Helpful? 0
  • +
  • -

#8 chance528   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 02-September 10

Re: PHP not working?

Posted 23 November 2010 - 02:06 PM

View PostAtli, on 23 November 2010 - 02:43 PM, said:

Is there any reference to "OCI.dll" in your PHP.ini file?

You say you get this when running a php script in your browser. Which HTTP server are you using, and how did you install PHP on that server? (That is, did you let the PHP installer configure the HTTP server to use PHP.)

Exact version numbers are helpful.


There was a segment of code like this:
[PHP_PDO_OCI]
extension=php_pdo_oci.dll



that was the only part of php.ini where I found oci.dll. PHP works fine on online files, but when I try to open a file saved on my PC, Chrome just downloads it.

Umm,... I don't think a server is related to this. It doesn't work with offline files.

By the way, I downloaded the latest version PHP 5.3.3
Was This Post Helpful? 0
  • +
  • -

#9 Atli   User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4241
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: PHP not working?

Posted 23 November 2010 - 03:02 PM

OK, I see.

Quote

When I try to run a PHP file in my browser, I get an HTML page with broken PHP code, or sometimes just a blank page.

What does the URL look like when this happens?

When you run a PHP file in a browser, the HTTP server serving the PHP file actually runs the PHP code and then sends the resulting HTML to the browser. The browser is never aware of the fact that any PHP code was executed. So unless your PC is running a HTTP server, and you are running a PHP website on your "local" server, there is no need for you to install PHP on your PC. (Unless you are using PHP as a programming language locally, but that's a whole different issue.)

That is why Chrome downloads PHP files when you try to open them locally, because a browser has no idea what PHP is so it just assumes you want to download it rather than view it. If you did manage to make the browser display the PHP file, the PHP code would be read as HTML, not executed as PHP, which usually leads to some weird display bugs.

Which leads me back to the URL that you are using when you get the broken PHP page. The problem is not with your browser, but with the HTTP server running the website of that URL.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1