Problem With Php Or Sql

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > The Internet > Website Discussion

Problem With Php Or Sql

adriantc
Hello! Some time ago (over 2 years) I used a script to make a website... In only customized a little the script and some more the HTML template. Over an year ago I noticed that something happened to the previously working website... tons and tons of PHP errors... Now keep in mind I haven't done any changes t the website for a long long time (had exams decisive for my life) and now I want to get back.
Since I don't know much PHP I want to get the experts opinion on why this errors appeared out of nowhere!


Thank you!

Reply

rvalkass
Without knowing what the errors are, its very difficult to say what has gone wrong. However, if you are certain you haven't touched the script then the other possibility is a PHP upgrade. Some functions are removed in newer PHP versions, some have their parameters changed, all sorts of stuff goes on. It is possible that one function has been changed. That then snowballs and causes loads of other stuff to fail in your script, hence the mountain of errors.

Also, if the script accesses a database, make sure it is using the correct username and password. If you changed those since you uploaded the script, then you need to give the script the new details.

If that doesn't help, post the errors you get here, and I should be able to offer more precise help.

Reply

jlhaslip
I agree with rvalkass. The trap is now running php 5.2.0 and Mysql 5.0.27, both of which have had serious changes from 2 years ago.
Get ready for php6 coming out soon. Very serious changes coming with that one. the option of running Safe Mode 'ON' is completely removed, apparently, which will do serious damage to older scripts which are programmed to be run under that.

Reply

adriantc
You can check the website from my signature for any errors. I'm sure you're both right so I guess it's hard now to find what function has changed. I wonder why don't they do PHP backwards compatible.
I don't what to upgrade it or anything, I simply what it to work. I have begun programming on a new project... but it will take a while and meanwhile I need it to work!

PS: This error emerged like 6-9 months ago without any changes whatsoever (no code changes, no password changes)

Reply

rvalkass
Just for simplicity, here are the errors:

CODE

1: Warning: include() [function.include]: open_basedir restriction in effect. File(/vars.php) is not within the allowed path(s): (/home/adriantc/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/adriantc/public_html/index.php on line 3

2: Warning: include(/vars.php) [function.include]: failed to open stream: Operation not permitted in /home/adriantc/public_html/index.php on line 3

3: Warning: include() [function.include]: Failed opening '/vars.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/adriantc/public_html/index.php on line 3

4: Warning: include() [function.include]: open_basedir restriction in effect. File(/regmail.php) is not within the allowed path(s): (/home/adriantc/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/adriantc/public_html/index.php on line 4

5: Warning: include(/regmail.php) [function.include]: failed to open stream: Operation not permitted in /home/adriantc/public_html/index.php on line 4

6: Warning: include() [function.include]: Failed opening '/regmail.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/adriantc/public_html/index.php on line 4

7: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/adriantc/public_html/index.php on line 5

8: Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/adriantc/public_html/index.php on line 6

9: Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/adriantc/public_html/index.php on line 6

The last 3 (errors 7, 8 and 9) are easy to fix. They show that you have passed no username, password or server name to a MySQL database connection. Make sure your script has the right username, password and server name in it. Also, make sure the function you use to connect to the database is still in the latest version of PHP. If not, replace it with the latest function and syntax.

Errors 1 to 6 refer to loading 2 external files. Firstly, make sure the two files (vars.php and regmail.php) still exist in the location the script is looking in. The error it comes up with (open_basedir) implies the script is trying to snoop around in locations it shouldn't be (such as other users accounts or system folders). Try changing the method you use to include those files to a simple include('filename.php'); . Again, that error could easily be caused by a PHP upgrade.

 

 

 


Reply

adriantc
Thank you for your help... I'll start figuring that out... By the way, can you tell me how I can stop the errors from appearing... as a temporal fix until I can check out every error?

Reply

galexcd
To stop php errors from occuring ad an @ symbol before each function that is giving you problems. Check the line numbers in the errors for seeing where to add them.

Example:
CODE
@include'file.php';

Reply

rvalkass
Personally I would actually put the following function at the very top of the page:
CODE
error_reporting(0);


That will turn all errors off. When you want them tuned back on, either remove that line or replace the 0 with E_ALL to turn all errors back on.

Reply

adriantc
Ok. Thank you everybody! I'll come back as soon as I will start fixing the problems!

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php sql


    Looking for problem, php, sql

Searching Video's for problem, php, sql
advertisement



Problem With Php Or Sql



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE