php not executed

Problems with the Windows version of XAMPP, questions, comments, and anything related.

php not executed

Postby webmasterbob » 10. April 2013 07:48

Hi all,

I started using Xampp a little time ago, yesterday a new problem occured.
When I run a php-file, he shows nothing, or a part of the code.

So i ran this code:

Code: Select all
<?

error_reporting(E_ALL);
ini_set('display_errors', '1');

require_once('classes/Database.php');

$db = new Database('database/pages.db');

$db->query("SELECT * FROM Pages");
if($db->numRows() == 0) {
   echo"No articles";
} else {
   
   foreach($db->rows() as $article) {
   
   echo $article['title'],'<br>';
   
   }
   echo '<p>', $db->numRows(), ' articles</p>';
}

$db->disconnect();

?>


My browser showed me:

query("SELECT * FROM Pages"); if($db->numRows() == 0) { echo"No articles"; } else { foreach($db->rows() as $article) { echo $article['title'],'
'; } echo '
', $db->numRows(), ' articles

'; } $db->disconnect(); ?>


Strange, because when I run this script on a webhost, everything works!
Also I tried a simple test like:

Code: Select all
<? echo 'Hello world'; ?>


Screen was empty.

I have searched on the internet for similiar problems, but it didn't help me out.
I am sure i am running the control-panel of xampp with apache and mysql.

Who can help me out?

Another thing: I have tried to use wampserver, to check it's my fault or xampp. wampserver gives me the same problem!
So guys, who can help me out?

Thank you all!

Bob
webmasterbob
 
Posts: 2
Joined: 10. April 2013 07:36
Operating System: Windows XP Professional

Re: php not executed

Postby webmasterbob » 10. April 2013 11:15

Hi all,

I fixed the problem.
I found out that shortcode wasn't enabled, so <? didn't work. <?php either worked great.
But, I got a new problem, I hope you can help me. I got the next message:

Fatal error: Call to undefined function sqlite_open() in C:\xampp\htdocs\cm\classes\Database.php on line 6

The strange thing is that it works perfect on my webhost.

Anybody?

Thanks!
webmasterbob
 
Posts: 2
Joined: 10. April 2013 07:36
Operating System: Windows XP Professional

Re: php not executed

Postby Altrea » 10. April 2013 12:31

Hi webmasterbob,

webmasterbob wrote:Fatal error: Call to undefined function sqlite_open() in C:\xampp\htdocs\cm\classes\Database.php on line 6

The strange thing is that it works perfect on my webhost.

configurations are different. Your webhost is using an older version of sqlite libraries than XAMPP is using.
If you want to connect to sqlite databases in XAMPP, please use the SQLite3 class for this:
http://www.php.net/manual/en/book.sqlite3.php

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8286
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: php not executed

Postby KeepSmiling » 04. May 2013 05:13

What is shortcode?
I installed xampp-win32-1.8.1-VC9-installer.exe and can't get an echo to work.

<?php
echo "Hello World";
?>

The localhost xampp page says everything is working. HTML will work, but it seems the php won't work. The page is named EchoTest.php. I don't get it. Sorry, I'm not that experienced but I think this should work.

I'm totally stuck. Any help would be appreciated.
KeepSmiling
 
Posts: 6
Joined: 04. May 2013 05:05
Operating System: Vista


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 32 guests