Jump to content

dil_bert

Members
  • Posts

    939
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by dil_bert

  1. hello dear Barand - and dear requinix - and all the supporter here!! first of all - many many thanks for the reply. i am very glad to be here on this great place. - many many thanks for the continued help and the your supprt. This is just great. And i am very very happy that you never have gave up the support and the continued help. Now it woks - i have talked to my serveradmin and he did some corrections. And now all runs like a chame. Note: i will talik to him and will ask him what exactly he did - in order to get to know what was the missing piece. I come back later the week and will let you know!!! Above all: Again - many many thanks for all you did. Barand -you deserve many many kudos. Keep up the great work it rocks. Note: you supprtet my php-questions for years now. probably you remember that you gave great hints as i was worin on a db-solution for open-streetmap-data. Keep up your great work regards Dilbertone
  2. - i guess that it is time to discuss all that with the serveradmin - since he is the guy that can change the configs...
  3. Good day dear Barand hello dear all. this error is quite very hard to fix . i re-checked some tests and the behavior of the server while running the following scripts define("HOST",'localhost'); define("USERNAME",'jc'); define("PASSWORD",'my_passwd'); $db = new PDO("mysql:host=".HOST,USERNAME,PASSWORD); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $res = $db->query("SELECT 7 * 6 "); echo $res ->fetchColumn(); //--> 42 ...throws back the following: define("HOST",'localhost'); define("USERNAME",'jc'); define("PASSWORD",'my_secret_passwd'); $db = new PDO("mysql:host=".HOST,USERNAME,PASSWORD); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $res = $db->query("SELECT 7 * 6 "); echo $res ->fetchColumn(); //--> 42 and the following script <?php $servername = "localhost"; $username = "jc"; $password = "my_passwd"; try { $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> ...throws back the following: Connection failed: SQLSTATE[HY000] [2002] No such file or directory I spend some time in trying to find out what goes wrong here: - see what i have found out: .... Connection failed: SQLSTATE[HY000] [2002] No such file or directory ..... what means according this thread: https://stackoverflow.com/questions/29695450/pdoexception-sqlstatehy000-2002-no-such-file-or-directory Quick test (run in shell): php -r "new PDO('mysql:hostname=localhost;dbname=test', 'username', 'password');" see the following: SQLSTATE[HY000] [2002] No such file or directory means php cannot find the mysql.default_socket file. Fix it by modifying php.ini file. On Mac it is mysql.default_socket = /tmp/mysql.sock (See PHP - MySQL connection not working: 2002 No such file or directory) SQLSTATE[HY000] [1044] Access denied for user 'username'@'localhost' CONGRATULATION! You have the correct mysql.default_socket setting now. Fix your dbname/username/password. Also see Error on creating connection to PDO in PHP ( cf: https://stackoverflow.com/questions/1435445/error-on-creating-connection-to-pdo-in-php ) Today, I removed and reinstalled the latest version of lampp in order to move to php 5.30, and suddenly a very simple app is failing to connect to the mysql database. I'm using PDO to connect, and receiving the following error: Warning: PDO::__construct() [pdo.--construct]: [2002] Invalid argument (trying to connect via unix://) in /home/raistlin/www/todoapp/home.php on line 9 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] [.. and so forth and so forth..] ..... see some answers that i have found for the cumbersome issues: answer1: Usually means that you need to specify TCP/IP (1), or tell MySQL where your Unix socket is (2): "mysql:host=127.0.0.1" or "mysql:host=localhost;port=3306" "mysql:unix_socket=/var/run/mysqld/mysqld.sock" answer2: answer3: You might want to modify php.ini so PDO can find mysql.sock by specifying the pdo_mysql.default_socket = /opt/lampp/var/mysql/mysql.sock (in the case of xampp). Don't forget to restart Apache after changing php.ini. cf: https://stackoverflow.com/questions/1435445/error-on-creating-connection-to-pdo-in-php well i think i have some issues on my server...
  4. hello dear Barand first of all - many many thanks for the reply. i am very glad to be here on this great place. some data statements: i am on SuSe-Linux 12.3 Webmin Authentic Theme 19.33 PHP Version 5.6.39 - [ note - this is just very old - i should tell my admin that he can update this] Build Date Dec 26 2018 22:47:34 mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock mysqli.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock PDO - settings PDO support enabled PDO drivers mysql, sqlite pdo_mysql pdo_mysql PDO Driver for MySQL enabled Client API version mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $ Directive Local Value Master Value pdo_mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock pdo_sqlite PDO Driver for SQLite 3.x enabled SQLite Library 3.8.10.2 settings and tests https://www.w3schools.com/php/php_mysql_connect.asp PDO support enabled PDO drivers mysql, sqlite pdo_mysql PDO Driver for MySQL enabled Client API version mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $ Directive Local Value Master Value pdo_mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock pdo_sqlite PDO Driver for SQLite 3.x enabled SQLite Library 3.8.10.2 see more <?php $servername = "localhost"; $username = "jc"; $password = "my password"; try { $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> result: Connection failed: SQLSTATE[HY000] [2002] No such file or directory btw;: Chrome-brwoser tells this page is not secure... #hmm - should i do some settings... - it is quite a bit intersting that the chrome-browser telling us that this page is not secure... define("HOST",'localhost'); define("USERNAME",'?'); define("PASSWORD",'?'); $db = new PDO("mysql:host=".HOST,USERNAME,PASSWORD); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $res = $db->query("SELECT 7 * 6 "); echo $res ->fetchColumn(); //--> 42 Of course it would fail if I tried to access columns from a table (in an unspecified DB) see the result: define("HOST",'localhost'); define("USERNAME",'jo'); define("PASSWORD",'my password'); $db = new PDO("mysql:host=".HOST,USERNAME,PASSWORD); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $res = $db->query("SELECT 7 * 6 "); echo $res ->fetchColumn(); //--> 42 hmmm - what can i do now !?
  5. first of all - many many thanks for the reply. i am very glad to be here on this great place. some first statements: i am on PHP Version 5.6.39 btw: I have Linux Server - based on opensuse: Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 the newest version of Webadmin - Webmin 1.910 see http://www.webmin.com/ i have testesd varios versions of the mysqli.connect-error-scripts... see the results: https://www.php.net/manual/en/mysqli.connect-error.php mysqli::$connect_error mysqli_connect_error (PHP 5, PHP 7) Example #1 $mysqli->connect_error example Object oriented style <?php $mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db'); // Works as of PHP 5.2.9 and 5.3.0. if ($mysqli->connect_error) { die('Connect Error: ' . $mysqli->connect_error); } ?> i also runned the prozedural-style <?php $link = @mysqli_connect('localhost', 'fake_user', 'my_password', 'my_db'); if (!$link) { die('Connect Error: ' . mysqli_connect_error()); } ?> and got back the following: Connect Error: No such file or directory note: i also runned this with the adviced replacement of localhost with 127.0.0.1 ... see below: <?php $link = @mysqli_connect(''127.0.0.1'', 'user', 'db-passwd', 'db-name'); if (!$link) { die('Connect Error: ' . mysqli_connect_error()); } ?> and i got back here: Connect Error: No such file or directory ...and here we have more insights - i also runned the PDO-version: see: https://www.w3schools.com/php/php_mysql_connect.asp <?php $servername = "localhost"; $username = "username"; $password = "password"; try { $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> see what i have got back: Connection failed: SQLSTATE[HY000] [2002] No such file or directory Note: In the PDO example above we have also specified a database (myDB). PDO require a valid database to connect to. If no database is specified, an exception is thrown. Tip: A great benefit of PDO is that it has an exception class to handle any problems that may occur in our database queries. If an exception is thrown within the try{ } block, the script stops executing and flows directly to the first catch(){ } block. cf. https://www.w3schools.com/php/php_mysql_connect.asp conclusio: all attemts to set up a mysql-db that is accessible from a Wordpress-installation failed. some more ideas that i need to think about. i should do some more tests and i will try to change "localhost" to "127.0.0.1 see https://www.fatalerrors.org/a/warning-mysqli-mysqli-hy000-2002-no-such-file-or-directory.html i further have to test PDO it is told to be much easier to deal with than MySQLi. what i need to do: a. i also have tried the changing "localhost" to "127.0.0.1" b. i have no experience with PDO but i will dig deeper into all that. I am going to read the docs. But see - i allready have done a first test with PDO above all: well - this is so crazy and i think that there some kind of magic things are happening. i have to do some more checks: - is there probably some firewalls in between the MySQL process and the network-stack and if it isn't that, - i might have a closer look at the editing of mysqli.default_socket in php.ini and i need to check that the path is set correct. and report all the findings. What can i do now!?
  6. some more ideas that i need to think about. i should do some more tests and i will try to change "localhost" to "127.0.0.1" https://www.fatalerrors.org/a/warning-mysqli-mysqli-hy000-2002-no-such-file-or-directory.html i further have to test PDO it is told to be much easier to deal with than MySQLi. [/quote] what i need to do. a. i will try the changing "localhost" to "127.0.0.1" b. i have no experience with PDO but i will dig deeper into all that. I am going to read the docs. above all: well - this is so crazy and i think that there some kind of magic things are happening. btw: the wordpress-experts told me that i should not use 127.0.0.1 instead of localhost for the servername. But while is constantly going wrong and does not work at all i am musing about using 127.0.0.1 instead of localhost as the server name. Besides that i think that there might be some more issues: i have to do some more checks - is there probably some firewalls in between the MySQL process and the network-stack and if it isn't that, - i might have a closer look at the editing of mysqli.default_socket in php.ini and i need to check that the path is set correct. the next things i will have to do: i do the change of "localhost" to "127.0.0.1" and report all the findings. Do you have and additional ideas what i can do and test!?
  7. Hello dear all many many thanks for the continued help and support. I am trying to figure out what has happened. see even more - i have runned several code examples - also this one....: <?php $mysqli = new mysqli("localhost", "db-user", "passwd", "db-name"); /* check connection */ if ($mysqli->connect_errno) { printf("Connect failed: %s\n", $mysqli->connect_error); exit(); } if (!$mysqli->query("SET a=1")) { printf("Errormessage: %s\n", $mysqli->error); } /* close connection */ $mysqli->close(); ?> Warning: mysqli::mysqli(): (HY000/2002): No such file or directory in /sites/www.job-starter.de/tt.php on line 2 Connect failed: No such file or directory well this is really funny...
  8. and besides the php-configuration if i use code with a closing tag - like so... . <?php $mysqli = new mysqli('localhost', 'jo', 'susi19', 'jo'); /* * This is the "official" OO way to do it, * BUT $connect_error was broken until PHP 5.2.9 and 5.3.0. */ if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error) } $mysqli->close(); ?> then i get back Warning: mysqli::mysqli(): (HY000/2002): No such file or directory in /sites/www.my_page.org/new_test.php on line 2 Connect Error (2002) No such file or directory still wonder what is going on here . and what i can do and test now
  9. hello dear all runned this code <?php $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db'); /* * This is the "official" OO way to do it, * BUT $connect_error was broken until PHP 5.2.9 and 5.3.0. */ if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $mysqli->close(); and got back this Parse error: syntax error, unexpected end of file in /sites/www.my-site.de/new_test.php on line 13 well what happened? i tryto figure it out
  10. hello + <?php $mysqli = new mysqli('localhost', 'jo', 'passwd', 'jo'); /* * This is the "official" OO way to do it, * BUT $connect_error was broken until PHP 5.2.9 and 5.3.0. */ if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $mysqli->close(); got back this result ... Parse error: syntax error, unexpected end of file in /sites/www.mysite.de/new_test.php on line 13 Hello dear Barand , i am trying to make sure that i have set up the MySQL use to be able to access the database via localhost? - this is pretty important! Aferward i have to try using the following code to connect to the DB <?php $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db'); /* * This is the "official" OO way to do it, * BUT wait - the $connect_error was broken until PHP 5.2.9 and 5.3.0. - so i have to make sure if i am the one that must be careful here */ if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $mysqli->close(); well i have to do some more test. i keep you posted - and i come back and report all the findings.
  11. Hello dear Barand , i am trying to make sure that i have set up the MySQL use to be able to access the database via localhost? - this is pretty important! Aferward i have to try using the following code to connect to the DB <?php $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db'); /* * This is the "official" OO way to do it, * BUT wait - the $connect_error was broken until PHP 5.2.9 and 5.3.0. - so i have to make sure if i am the one that must be careful here */ if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } $mysqli->close(); well i have to do some more test. i keep you posted - and i come back and report all the findings.
  12. Hello dear Barand , first of all many thanks for the reply and your ideas and the sharing of ideas and insights. well i am so thankful that you gave me the hint several days. note: at the moment i am not at home - i am just traveling - and i have no access on the server - but as soon as i am back home i will do the tests on the server and i wll check some words regarding the installation: I have Linux Server. Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 -installed. There are several wordpress website running on server. I have checked this all one week ago, In the phpinfo(); what do you suggest - should i ask my serveradmin that he will update & upgrade the whole system - in order to have a modern system... And then i run the mysqli_error_(function)!? I love to hear from you mysqli_error() function / mysqli::$error The mysqli_error() function / mysqli::$error returns the last error description for the most recent function call, if any. Syntax: Object oriented style string $mysqli->error; Procedural style string mysqli_error ( mysqli $link ) Parameter: Name Description Required/Optional link A link identifier returned by mysqli_connect() or mysqli_init() Required for procedural style only and Optional for Object oriented style Usage: Procedural style mysqli_error(connection); the Parameter: Name Description Required/Optional connection Specifies the MySQL connection to use. Required Return value: A string that describes the error. An empty string if no error occurred. Version: PHP 5, PHP 7 Example of object oriented style: <?php $mysqli = new mysqli("localhost", "user1", "datasoft123", "hr"); /* check connection */ if ($mysqli->connect_errno) { printf("Connect failed: %s\n", $mysqli->connect_error); exit(); } if (!$mysqli->query("SET a=1")) { printf("Errormessage: %s\n", $mysqli->error); } /* close connection */ $mysqli->close(); ?> Copy Output: Errormessage: Unknown system variable 'a' Example of procedural style: <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } if (!mysqli_query($link, "SET a=1")) { printf("Errormessage: %s\n", mysqli_error($link)); } /* close connection */ mysqli_close($link); ?> Copy Output: Errormessage: Unknown system variable 'a' Example: <?php $con=mysqli_connect("localhost","user1","datasoft123","hr"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Perform a query, check for error if (!mysqli_query($con,"INSERT INTO employees (First_Name) VALUES ('David')")) { echo("Errorcode: " . mysqli_errno($con)); } mysqli_close($con); ?> Copy Sample Output: Errorcode: 1146 and dear Barand - i am happy bout your ideas regading the comparison - and for the sharing of the ideas: some words regarding the installation: I have Linux Server. Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 -installed. There are several wordpress website running on server. I have checked this all one week ago, In the phpinfo(); what do you suggest - should i ask my serveradmin that he will update & upgrade the whole system - in order to have a modern system... And then i run the mysqli_error_(function)!? I love to hear from you
  13. Hello dear experts and user of PHPFreaks, first of all: i have plenty of issues - a whole bunch of issues on a Server - i need to digg deeper into all things regarding creating a healthy db-connection. Therefore i need to learn all about the script - mysql_connect_error... see below. i have gathered some information - in order to think about it - and to share the ideas ... so i hopefully will learn and solve my issues. well the mysql_connect_error-script is a great help: It returns a string description of the last connect error ( see more infos here: https://www.php.net/manual/en/mysqli.connect-error.php ). The mysqli_connect_error() function returns the error description from the last connection error, if there is any error-note. the return value are the following ones: a. A string that describes the error. b. an empty string if no error occurred. at least this goes for the Version: PHP 5, PHP 7 well - if we run the code below we can get the info bout the option to connect to the db. What if we run this as a mysql-test-script, and what if we will want to convert it to use mysqli? Can this be done by changing mysql _query($sql); to mysqli _query($sql); ? <?PHP // the test-script that we are running. $DB["dbName"] = "emails"; $DB["host"] = "localhost"; $DB["user"] = "root"; $DB["pass"] = ""; $link = mysql_connect($DB['host'], $DB['user'], $DB['pass']) or die("<center>Howdy - be aware; There a thing happenede - An Internal Error has Occured. Please report following error to the webmaster shot him a mail now.<br><br>".mysql_error()."'</center>"); mysql_select_db($DB['dbName']); // end header connection part // function from a functions file that I run a mysql query through in any page. function executeQuery($sql) { $result = mysql_query($sql); if (mysql_error()) { $error = '<BR><center><font size="+1" face="arial" color="red">An Internal Error has Occured.<BR> The error has been recorded for review</font></center><br>'; if ($_SESSION['auto_id'] == 1) { $sql_formatted = highlight_string(stripslashes($sql), true); $error .= '<b>The MySQL Syntax Used</b><br>' . $sql_formatted . '<br><br><b>The MySQL Error Returned</b><br>' . mysql_error(); } die($error); } return $result; } // example query ran on anypage of the site using executeQuery function $sql='SELECT auto_id FROM friend_reg_user WHERE auto_id=' .$info['auto_id']; $result_member=executequery($sql); if($line_member=mysql_fetch_array($result_member)){ extract($line_member); } else { header("location: index.php"); exit; } ?> If we do replace mysql_* with mysqli_* then we will have to bear in mind that a whole load of mysqli_* functions need the database link to be passed. E.g.: the following ones. mysql_query($query) becomes mysqli_query($link, $query) I.e., lots of checking required. on the other hand side: is it suffice if we replace every mysql_* function call with its equivalent mysqli_*, when we will use the procedural API (note: there is some code based on the MySQL API, which is a procedural one - at least afaik), To help with that, the The MySQLi Extension Function Summary-manual is definitely something that will prove helpful. We can do the following: we have the following options to do that: - mysql_connect will be replaced by mysqli_connect - mysql_error will be replaced by mysqli_error and/or mysqli_connect_error, depending on the context - mysql_query will be replaced by mysqli_query ,,,, and so on and so forth. Note: For some functions, we may need to check the parameters very very carefully: Maybe there are some differences here and there -- but not that many differences. Belive me. Both mysql and mysqli-codes are based on the same library ( the great and powerful libmysql ; at least for PHP-version <= 5.2) Usage - for instance: with mysql, we have to use the mysql_select_db once connected, to indicate on which database we want to do our queries mysqli, on the other side, allows us to specify that database name as the fourth parameter to mysqli_connect. what do you think bout this.. love to hear from you
  14. BY THE WAY: - My Server admin adviced me to do some extra tests; - running an installation with another script - a other than wordpress - to see if the installation probably would succeed with another script. well i am musing bout these advices - and will follow them. I must have more insights into the magic. will come back and report all findings. greetings
  15. first of all - many thanks dear Barand and Maxxd for the reply and your continued support: here some more insights and Output from SQL command SHOW GRANTS FOR 'jo'@'localhost'; .. Output from SQL command SHOW GRANTS FOR 'jo'@'localhost'; .. Grants for jo@localhost GRANT USAGE ON *.* TO 'jo'@'localhost' IDENTIFIED BY PASSWORD '*93C1B40FA5F0FED10E5A0CE946A5E71D59B00860' GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON `jo`.* TO 'jo'@'localhost' hmmm - running the SQL-Request works now - without any issue. but for the results : i try to figure out what these results mean. Guess that i can verify the issues.
  16. hello dear MaxxD and Barand, first of all - many many thanks for the reply with all the ideas and suggestions. many many thanks for the quick answer with all the ideas, that are very interesting. here a little update and more findings: by the way: if i do not use USE <db-name> .... then it works propperlyconclusio: if i run SHOW GLOBAL VARIABLES LIKE 'PORT';[/CODE]i get a concrete output from SQL command SHOW GLOBAL VARIABLES LIKE 'PORT'; ..or if i run [CODE] SHOW GRANTS FOR CURRENT_USER;[/CODE]i get outputs like this one[CODE] Output from SQL command SHOW GRANTS FOR CURRENT_USER; .. Grants for root@localhost GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*4444444rrrrrrwwwww222222444443660283C379783ED8EF54B6EC01DAF8374444444rrrrrrrrrrrreeeeewwwww2CeC3C474F4' WITH GRANT OPTION GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION [/CODE]and now i have to rethink what this does want to say in the context of a - error in trying to establish a db-connection - while installing a wordpress on the frontendlook forward to hear from you greetings
  17. hello dear Barand hello dear MaxDD many many thanks for the quick reply - @Barand - yo told me to do /use the following: to run the following command: mysqli_connect_error (PHP 5, PHP 7) https://www.php.net/manual/en/mysqli.connect-error.php mysqli::$connect_error -- mysqli_connect_error — Returns a string description of the last connect error Object oriented style string $mysqli->connect_error; Procedural style mysqli_connect_error ( void ) : string Returns the last error message string from the last call to mysqli_connect(). Return Values ¶ A string that describes the error. NULL is returned if no error occurred. Examples ¶ Example #1 $mysqli->connect_error example Object oriented style
  18. hi dear all have errors like error in establishing a database-connection. @requinix i have had a talk with my serveradmin - and we do the upgrades in the near fruture--- well i try to find out more;; i need to know more about the system: i have to try the access of mysql in a console using the user name and password you set up? mysql -u <username> -p where <username> is your user name and we will be prompted for a password. well i need to try to find out more - i will do more investigations - and come back later. have a great day
  19. hello again - i try to work it out... can i run this sheme all data in two columns or should i put it in one column
  20. i will have a closer look at sqlalchemy which is shure a a pretty good library: https://docs.sqlalchemy.org/en/13/orm/tutorial.html and besides this i will have a closer look at peewee. have a great day
  21. hello dear Community, a class for storing contact data - Here is the code of a simple custom class which stores information about a person: import datetime # so we will use this for date objects class Person: # this is it - this is the class def __init__(self, name, surname, birthdate, address, telephone, email): self.name = name self.surname = surname self.birthdate = birthdate self.address = address self.telephone = telephone self.email = email def age(self): today = datetime.date.today() age = today.year - self.birthdate.year if today < datetime.date(today.year, self.birthdate.month, self.birthdate.day): age -= 1 return age person = Person( "Joe", "Doe", datetime.date(1952, 4, 22), # year, month, day "No. 1444 Short Street, Munich", "555 4564444444444444 0987", "joe.doe@example.com" ) print(person.name) print(person.email) print(person.age()) i want to store the data in a database. background: We start the class definition with the class keyword, followed by the class name and a colon. i think it is not bad to list any parent classes in between round brackets before the colon, but this class doesn’t have any, so i can leave them out. Inside the class body, we ve got two functions – these are our object’s methods. 1. The first method: is called __init__, which is a special method. When we call the class object, a new instance of the class is created, and the __init__ method on this new object is immediately executed with all the parameters that we passed to the class object. The purpose of this method is thus to set up a new object using data that we have provided. The second method is a custom method which calculates the age of our person using the birthdate and the current date. i want to store the data in a db or in a file
  22. on a sidenote,. ... <?php if(function_exists('mysqli_connect')){ if(!($link = mysqli_connect('localhost','user','passwd','my_db'))){ die('could not connect: ' . mysqli_error($link)); } } else { die("don't have mysqli"); } echo 'connect successfully'; mysqli_close($link); [/CODE] well i guess that this is saying that 1 parameter was required, 0 were provided. and besides this we surely can say that there absolutly no error checking is being done before calling the function, it's blindly passing a variable that was collected. interesting: This actually makes sense, given i am probably failing to connect to mysql. What we don't see is validation that the credentials work, & i can connect. one option would be to ssh to the php server, & then connect over the cli to mysql. Otherwise, we´re just guessing. Above all - we can say that there probably is no pathing issue. honestly - there are serious doubts that wordpress has a pathing issue, or this is anyway code related. [CODE]active_connections 18446744073709551563 is this number normal? If not how can I reduce it? [/CODE] If this were the cause of the issue, none of the sites would work, assuming they are all using the same mysql server. The quickest way to reduce it would be to reboot the server. Just posting the number alone doesn't tell us enough. best thing would be to verify with netstat. If they are active connections, then i probably should have a closer look a the proper firewall rules in place blocking outside connections. hmm - i will have a closer look at all the condidions and settings - and will come back and report all the findings. have a great day
  23. hello dear Requnix - first of all - many many thanks for the quick reply great to hear from you. Well yes: i am going to check all the environment things - and i also want to replace "localhost" with 127. 0.0.1 btw: I have Linux Server. Apache 2.4.10, PHP Version 5.6.39 and mysqlnd 5.0.11-dev - 20120503 - installed. There are several wordpress website running on server. In the phpinfo(); under mysqlnd section there says; active_connections 18446744073709551563 is this number normal? If not how can I reduce it? and sorry - for the bit of confusing thread-posting with the issues. I am in need of help and i try to sort out things here. regards -
  24. hello dear all - have issues while connecting to the mysql-db during the installation process of a wordpress. i have a root-server that is administered by my friend. i can configure all the things that need to be configured with Webadmin: in other words: on the webmin-frontend (that is the area i have to controll and configure all the stuff on the server') i get back the results -error in establishing the db-connection while running the installation script of wordpress version 5.2 what else did i try out: i run a extra script to test the connection - and i got back this here... Warning: mysqli_connect(): (HY000/2002): No such file or directory in /sites/www.mysite.de/tests.php on line 3 Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /sites/www.mysite.de/tests.php on line 4 could not connect: yyyyyy see the script: <?php if(function_exists('mysqli_connect')){ if(!($link = mysqli_connect('localhost','user','passwd','my_db'))){ die('could not connect: ' . mysqli_error($link)); } } else { die("don't have mysqli"); } echo 'connect successfully'; mysqli_close($link); the guess: the paths seem to be a problem - in the config by the way: the character-code is 1252 ANSI L well i want to do more tests - on the webmin-frontend (that is the area i have to controll and configure all the stuff on the server') USE yourdatabase; SHOW GLOBAL VARIABLES LIKE 'PORT'; SHOW GRANTS FOR CURRENT_USER; i get back the following results: Failed to execute SQL : SQL USE 'name of my db'; SHOW GLOBAL VARIABLES LIKE 'PORT'; SHOW GRANTS FOR CURRENT_USER; failed : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''name of my db'; SHOW GLOBAL VARIABLES LIKE 'PORT'; SHOW GRANTS FOR CURRENT_USER' at line 1 well what can i do now
  25. hello again - i have gathered some more infos and insights due to some more tests. see the following data: - the outcome of a testscript: Warning: mysqli_connect(): (HY000/2002): No such file or directory in /sites/www.mysite.de/tests.php on line 3 Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /sites/www.mysite.de/tests.php on line 4 could not connect see the script: <?php if(function_exists('mysqli_connect')){ if(!($link = mysqli_connect('localhost','user','passwd','my_db'))){ die('could not connect: ' . mysqli_error($link)); } } else { die("don't have mysqli"); } echo 'connect successfully'; mysqli_close($link); some ideas: the paths seem to be a problem - in the config by the way: the character-code is 1252 ANSI L any idea and help - i look forward to hear from you regards
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.