Page 1 of 1

Php doesn't seem to work after installation

PostPosted: 04. October 2017 08:58
by nic.el
I have the same problem, so
After finishing XAMPP installation, where no eerors or warnings were prompted, and tried to fix ports, 80 to 8082 and 443 to 44343. I was not have any contact with the Server, coming back to ports 80 and 443, I was able to run localhost/xampp and localhost/phpmyadmin. Then made a NEW folder (testfolder) into htdocs directory and tried to connect to a table in mariaDB by name mytesttable. with a script like this:
<title>
<html>
<head>
</body>
HTML SECTION
<?php
db_name = 'test";
db_usr = 'root';
db_pass = 'root's password';
echo ("this is php section');
.......Connection commands......
echo ('end of php section');
/?php>
END OF HTML
</body>
</html>

the PHP section is completely ignored in my case no matter how many times I tried.
Pls advise me.

Re: Php doesn't seem to work after installation

PostPosted: 04. October 2017 10:56
by Altrea
Hi,

Your problem is probably different so i have splitted it from the original thread.
Read more about the "one thread per unique user and issue" rule here:
=> [INFO] How to not fail getting help here

How do you try to run your file in your browser?
What address does your browsers address bar show?
Read more about Apache not parsing PHP code here
=> [Q&A] Apache won't parse php code

Please read the following post to get to know why http://localhost/ does not work anymore if you change the default Apache ports
=> [Q&A] Changing the Apache default ports


best wishes,
Altrea

PHP ignored completed in .php module

PostPosted: 05. October 2017 06:03
by nic.el
I have the same problem, so
After finishing XAMPP installation, where no eerors or warnings were prompted, and tried to fix ports, 80 to 8082 and 443 to 44343. I was not have any contact with the Server, coming back to ports 80 and 443, I was able to run localhost/xampp and localhost/phpmyadmin. Then made a NEW folder (testfolder) into htdocs directory and tried to connect to a table in mariaDB by name mytesttable. with a script like this:

Code: Select all

<title>
<html>
<head>
</body>
HTML SECTION
<?php
echo ('php section');
$db_host = 'localhost";
db_name = 'test";
db_usr = 'root';
db_pass = 'root's password';
$conn = mysql_connect (db_host, dbuser,  dbpass);
if (!conn) { die ('Unable to connect: ' . mysql_error()); }
echo ('Connected');
mysql_close($conn);
echo ('end php'');
?php>
END HTML
</body>
,/html>



The script was written on notepad++ and saved in xampp\htdocs\test by the name test_conn.php. The url given in both Firefox and Internet Explorer is:
localhost/test/test_conn.php.
The HTML messages are presenting, but the PHP are not!

Prehistory: When I installed XAMPP on a stand alone machine, I changed the suggested ports: 80 -> 8082 and 443 -> 44343 as suggested, but Apache was not running. So I reinstalled, fearing for remained errors, with the initial values of the ports. Watching the control pannel I didn' t found any error or warning.

Canot think any solution

Re: PHP ignored completed in .php module

PostPosted: 05. October 2017 09:13
by Nobbie
Code: Select all
?php>


That is a syntax error, you are using the wrong closing tag. It must be simply "?>" instead. Instead of the control panel, watch the error_log. I am pretty sure that there is somekind of error message "unexpected end of file" or similar.

Re: Php doesn't seem to work after installation

PostPosted: 05. October 2017 09:45
by nic.el
After your suggestion to post on another distinct message my question, which I have already done, if you look at my posts, you realize that the script on the browser is
localhost/testfoler/testconn.php, where php lies on xampp/htdocs/test_folder. There is no any error or warning, just the html Lines are appearing. thank you for your time nic

Re: PHP ignored completed in .php module

PostPosted: 05. October 2017 10:11
by nic.el
Examining the script i found that the PHP part is as you stated thus ?> the above script was misstype on behalf of me. As I noticed before there no message on xampp' s control pannel starting stoping apache and/or mysql
Thank you and forgive any incovinience that I produced with my eeroneus typing - nic

Re: PHP ignored completed in .php module

PostPosted: 05. October 2017 12:09
by Nobbie
If the error remains, please COPY & PASTE the script into this forum, DO NOT TYPE IT IN. We urgently have to see ORIGINAL code. Also look into the error_log for any hint.

Re: PHP ignored completed in .php module

PostPosted: 05. October 2017 13:44
by Altrea
echo ('php section');
$db_host = 'localhost";
db_name = 'test";
db_usr = 'root';
db_pass = 'root's password';
$conn = mysql_connect (db_host, dbuser, dbpass);
if (!conn) { die ('Unable to connect: ' . mysql_error()); }
echo ('Connected');
mysql_close($conn);
echo ('end php'');
?php>
END HTML
</body>
,/html>

This code is full of errors, are you kidding?

Re: PHP ignored completed in .php module

PostPosted: 09. October 2017 06:16
by nic.el
As I alredy mentioned the statement
?>
is the last line of the php section, it was a misstyping, since the server is not connected to the Internet, and I had to retype it to post my problem!
As far it concerns additional errors you can find out that are identical to the Maria' s DB tutorials (e.g. www.tutorialspoint.com), in all gogled search
on behalf of mine

Re: PHP ignored completed in .php module

PostPosted: 09. October 2017 06:29
by Altrea
nic.el wrote:since the server is not connected to the Internet, and I had to retype it to post my problem!

If the server is not connected to the internet you also needed to retype the code from the tutorials on the server.
So how can we say that you did not mistyping on your server too?
We do not know your current code, we do not know your current log.
Providing remote help with that amount of information is impossible.