I had a client that asked for a Flash website with dynamic text and input via PHP to MySql. I developed it and it worked perfectly, although I had to test and develop on three servers/hosting companies because they never gave me the information about where it was going to be hosted. Well, it was all up and running perfectly until they gave me the information where it was to be hosted. Here is what they have to say about PHP :
We do support PHP scripting, but it is not built into the web server. What this means is that you can execute PHP code like you would execute C or Perl code, as a CGI script. You will not be able to use the PHP "includes" or "extensions" however.
If you wish to use it, be sure to put your file/s in your cgi-bin.
If a CGI script is not in the cgi-bin/ directory, the file must end in .cgi. It also must be set executable and it needs to have the standard #!/path/to/interpreter reference on the first line of the file. The path to PHP is /usr/local/bin/php.
The current version installed (from the -v flag) is: 4.0.2
===========================================
Here is an edited sample of one of the scripts:
#!/usr/local/bin/php
<? PHP
$link = @mysql_connect(connection, user, password);
return $link;
$link = dbConnect();
if (!$link)
{
print "&newsText=" . urlencode("Could not connect to server");
exit;
}
if (!@mysql_select_db(databasename))
{
print "&newsText=" . urlencode("Could not select databasename database");
exit;
}
$query = "SELECT newsText
FROM tablename
ORDER BY updateID DESC
LIMIT 1";
$result = @($query);
if ($result && @mysql_num_rows($result) > 0)
{
$newsText = "";
while($row = mysql_fetch_array($result))
{
$newsText .= stripslashes($row['newsText']) . '';
}
print "&newsText=" . urlencode($newsText);
}
else
{
print "&newsText=" . urlencode("No items in database yet");
}
mysql_close($link);
?>
Nothing happens when Flash calls to the script, which I put in the cgi-bin and put the path to interpreter line just to be sure. The CHMOD is changed to 755 as perscribed the hosting company. Tech support said that the scripts were running fine but there was a syntax error. I know that the script isn't executable through the browser, but I do check the url of the script it says "No Input File Specified". I know that my code is probably sloppy, but does anyone see anything in the code that would be the problem? Thanks for the input and help.