cancel
Showing results for 
Search instead for 
Did you mean: 

PHP files not being served at ccgi.username.plus.com

dunbankin
Grafter
Posts: 26
Fixes: 1
Registered: ‎28-05-2008

Re: PHP files not being served at ccgi.username.plus.com

The PHP5-CGI .htaccess contains:

# for PHP5-CGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php-cgi

# for php and securewebexchange
<IfDefine SSL>
AddHandler php-cgi .php
Action php-cgi https://secure50.securewebsession.eu/ccgi.jpdljd.plus.com/cgi-bin/php-cgi
</IfDefine>

But I still get the same Not Found error.  I've tried renaming the file to htaccess.bak, as suggested, and this gives partial success - my php page starts to load and run (and indeed reports that PHP is still v7.1.15), but then fails somehow - I think when it tries to connect to my database.  I don't understand all this "fastcgi module" stuff, I'm afraid.  I also don't understand why changing the PHP version in PHP Manager automatically inserts a .htaccess file which then stops my PHP file executing and produces a Not Found error - it doesn't make any sense to me.  I'll have another look at my old db connect code.  Am I right in assuming that if I have forced PHP5-CGI (and deleted the counter-productive .htaccess file), I can still use mysql_connect and all the rest of my old code?  I know I'll have to convert to mysqli_connect eventually, but I'm just trying to get my page working again...  The relevant bit of my code is :

//connect to  database 
//mysql_connect("localhost","username","password"); //(host, username, password)
mysql_connect("sql5c51a.megasqlservers.eu","ccgiusernamechanged","pwdchanged"); //(host, username, password)
//specify database 
mysql_select_db("jpdljd_pn_ccgi_jpdljd_plus_com") or die("Unable to select database"); //select which database we're using

Oh dear - no error checking.  I'll add some to try and clarify why no connection.

spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: PHP files not being served at ccgi.username.plus.com

I think the best way forward with this could be to revert back to PHP-DEFAULT in PHPManager, then update your code to work with PHP 7.1.15. That will require all database calls to be changed from mysql_* style to mysqli_* equivalents because the mysql extension was removed with effect from PHP 7. The following extract from a post I made in another topic https://community.plus.net/t5/Everything-else/PHP-MySql-Unable-to-connect-Are-there-recent-changes/m... might help get you started. Note that this replaces both the mysql_connect and mysql_select_db statements. Of course the parameters shown below need to be set to appropriate values for your code.

....  For example the equivalent of your mysql_connect statement, and the mysql_select_db statement which will follow it is

$connection = @mysqli_connect($host, $user, $password, $database)
  or die('Connect Error ('
. mysqli_connect_errno() . ') ' . mysqli_connect_error());

It is necessary that $connection is the first parameter in subsequent mysqli_* statements which access the database (rather than just manipulating query result objects).

The PHP manual which references all the mysqli functions can be found at http://php.net/manual/en/mysqli.construct.php

Updating from mysql_* to mysqli_* requires care but is not difficult.


David