jasonc Posted May 9, 2010 Share Posted May 9, 2010 My host has recently upgraded to cPanel 11.25.0-S43473 - WHM 11.25.0 - X 3.9 REDHAT Enterprise 5.2 x86_64 standard and doing so has caused my suspended page not to work like before. i have a contact us page that stored the messages in a mysql database as well as email them to my email address. now this does not work and i have been told that PHP does not work in a .cgi file. how do i access the MySQL database using .cgi files ? Quote Link to comment https://forums.phpfreaks.com/topic/201148-accessing-mysql-using-cgi-file/ Share on other sites More sharing options...
trq Posted May 9, 2010 Share Posted May 9, 2010 Depends on what language the cgi file is written in. cgi scripts cab be written in many different languages including Perl, Python, Ruby and PHP. Quote Link to comment https://forums.phpfreaks.com/topic/201148-accessing-mysql-using-cgi-file/#findComment-1055309 Share on other sites More sharing options...
jasonc Posted May 9, 2010 Author Share Posted May 9, 2010 strange as my host says that PHP will not run in the cgi file!! ok i have tried to add just basic php like so... <? echo("hello world"); ?> i would expect hello world to show but i get <? echo("hello world"); ?> at the top of my page or where ever i place this php code. so it seems that PHP is not being executed as PHP Quote Link to comment https://forums.phpfreaks.com/topic/201148-accessing-mysql-using-cgi-file/#findComment-1055313 Share on other sites More sharing options...
Mchl Posted May 9, 2010 Share Posted May 9, 2010 Try using <?php instead of <? Quote Link to comment https://forums.phpfreaks.com/topic/201148-accessing-mysql-using-cgi-file/#findComment-1055319 Share on other sites More sharing options...
jasonc Posted May 9, 2010 Author Share Posted May 9, 2010 mmm i did try that before but tried again and still got the same result, and on viewing the source code the php code is visable. <?php echo("hello"); ?> would there be a setting on the setver that prevents the php from being executed in cgi files ? Quote Link to comment https://forums.phpfreaks.com/topic/201148-accessing-mysql-using-cgi-file/#findComment-1055322 Share on other sites More sharing options...
trq Posted May 10, 2010 Share Posted May 10, 2010 cgi files usually require a shebang line at the top to tell the server what program needs to execute the script. Something like.... #!/usr/bin/php However, if your host is saying that php cgi isn't supported I would tend to believe them. Quote Link to comment https://forums.phpfreaks.com/topic/201148-accessing-mysql-using-cgi-file/#findComment-1055685 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.