views:

56

answers:

5

I have html file with php code in it. It contains code to connect to mysql database.

When i run it, it returns me an error:

Fatal error: Call to undefined function: mysql_connect() 

Everything works fine if file extension is php.

Also, just to mention that using .htaccess I have rewritten file extension.

Also some functions, like include and echo work fine.

Can you help me please how to handle this?

Update: Here is the .htaccess file:

RewriteEngine On
RewriteBase /

RewriteRule ^item/(.*) item.html/$1
RewriteRule ^page/(.*) page.html/$1
RewriteRule ^page2/(.*) page2.html/$1
RewriteRule ^browse/(.*) browse.html/$1

RewriteRule ^(.*).txt /page/error.html

ErrorDocument 400 /page/error.html
ErrorDocument 401 /page/error.html
ErrorDocument 403 /page/error.html
ErrorDocument 404 /page/error.html
ErrorDocument 500 /page/error.html
DirectoryIndex index.html index.php index.php3 index.htm index.html.var
AddHandler application/x-httpd-php .html
A: 

Try adding to htaccess...

AddType application/x-httpd-php .html .htm
Webarto
still the same...
web hosting issue, address to your support.
Webarto
A: 

This means mod_mysql (MySQL extension) is not installed or was not loaded correctly on the Apache web server.

Otar
+1  A: 

run phpinfo() in both files and see.
There will be 2 different versions of PHP.
Most likely your mysql-enabled version has a different handler, like application/x-httpd-php5 or something

Col. Shrapnel
you are right! there are two different versions of PHP. I will wait for support to get info what to do next.
A: 

Comment out all offending lines of code until the script runs (even if with warnings and notices); drop a phpinfo() at the start, run the script and check out what php.ini is it picking up.

You may have a stray php.ini somewhere with the mysql extension commented out... If so, edit it to load the required mysql extension. If you find out that the mysqli extension is loaded instead, just change every mysql_* function in your code to mysqli_* and you're done.

djn
A: 

it's server issue. hosting provider admit that it's their mistake.