Page 1 of 1

php not executed

PostPosted: 10. April 2013 07:48
by webmasterbob
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

Re: php not executed

PostPosted: 10. April 2013 11:15
by webmasterbob
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!

Re: php not executed

PostPosted: 10. April 2013 12:31
by Altrea
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

Re: php not executed

PostPosted: 04. May 2013 05:13
by KeepSmiling
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.