I have just installed XAMPP again, I was using IIS but I have now disabled that.
For some reason disabling it didn't seem to work, as the ports still clashed, so instead I have changed the port for Apache to "1234".
As you can see from the control panel below XAMPP seems to be running just fine, the index page shows up fine at least.
I made a quick test page and placed it in my install directory (C:\xampp\htdocs\testing.php)
<?
$test = "hello world";
echo $test;
?>
I then load this location in Chrome: http://localhost:1234/testing.php
But for some reason the page is blank, when I view the pages source I see this:
<?
$test = "hello world";
echo $test;
?>
Any ideas?
Edit:
Fixed thanks, I was an idiot and didn't open it with
Instead of wasting this thread for such a stupid mistake here is another question.
Is there a version of Chrome or Firefox I can use to run my website but lock it in full screen and require a password to get out of it?
Try to use <?php tag instead of <?, this is often disabled in standard php installations.
BTW, to activate short tags, the property is
short_open_tag=On
in your php.ini.
Related
I am trying to create my first dynamic site on windows server 2008 r2. I have created other dynamic sites successfully on linux based systems but I am having a little bit of trouble with this.
So i have php, mysql and phpmyadmin installed on the server.
I have a page (index.php) with the following:
<?php
include 'php/index.php';
mysql_set_charset('utf8');
?>
This works fine and does not show when i do 'view source' on the displayed page in a web browser.
Further down my page i have the following:
<?=$obj->get_email()?>
This statement is to be used to pull information from a database. When i do view source it shows the get_email() command as seen above. Instead of what it should be replaced with .
Is this a PHP issue? Is this type of command not suitable with windows server or am i just doing something completely stupid??
Try it without short tags:
<?php echo $obj->get_email(); ?>
You should check php.ini for the setting: short_open_tag and change it to 1 if you wish to be able to use <? to jump into PHP mode.
Barring that, just changing it to <?php echo $obj->get_email(); ?> will fix your problem.
Reference
i'm a PHP developer, and trying Webmatrix lately,
I have successfully install PHP to IIS, and use it, it's pretty neat I say
then, one time i hit this problem
while
<?php echo "Hello World"; ?>
or
<? echo "Hello World"; ?>
works just fine,
but
<?= "Hello World"; ?>
is not working at all, and i thought it was my mistake, then i start apache, and run it from there, and it works..
So, how to get to work?
It work on apache, but not on IIS.. anyone having same problem?
I'm using PHP 5.3.8 + IIS 7.5 Express + Web Matrix
Thanks
Resolved
OK, I have resolve this problem,
The answer is simple and annoying, I'm using Windows 7, the main problem is UAC,
every time i save the php.ini, it's saved to the Virtual Store instead of the original location (because i dont use administrator right when editing)
I tried to edit the php.ini under administrator right, and Boom! worked like a charm!
Thanks for your answer
Check if the short-open-tag is enabled in your php.ini
http://www.php.net/manual/en/ini.core.php#ini.short-open-tag
I am using wamp server 2.0 on windows XP with PHP version 5.2.5 when I am using the following code
<?
echo "hai";
?>
I am not getting the output. But when I am using
<?php
echo "hai";
?>
Got the result.If I am using the first one in Linux server I got the output.One of my large project like the first one in all php pages.I want to configure with wamp.SO if first coding needs to work what can I do?
My first guess is your php.ini isn't configured for this. The parameter short_open_tag is responsible for it.
Edit your php.ini, search the following parameter and activate it (or add it when its missing there):
short_open_tag = On
More details are in the php-manual.
i'm not using wamp now, maybe you can test solution from http://www.wampserver.com/phorum/read.php?2,50473,50474#msg-50474.
Wish this can help you. :)
I have a php-file which includes another html-file:
<? virtual("../top.html");?>
The problem is that any code before this include compiles and runs well, after - nothing. There aren't any errors etc. After commenting this line, everything works.
Code was written under local computer with ArchLinux + LAMP. Now I have ubuntu 10.04 with the same configuration.
What could it be?
You might try changing top.html to top.phtml and using require_once.
<?php require_once('../top.phtml'); ?>
If you just want to pass some html from a file into your output, you could also use:
<?php echo file_get_contents('../top.html'); ?>
That way, you stay independent of the underlying webserver and you make sure, that no php code that may be in the html is being executed.
However if you wish something in there to be executed, you can use require_once() as stated by Jeremy.
Can you check error log of the Apache?
Also, you should use
<?php virtual("../top.html");?>
if your php.ini has short_open_tag = Off.
I am writing a php app on the websever I set up at my house. It is a fedora10 machine, running php5 and mysql. I have code like this:
<?php echo $var->function(); ?>
But for some reason the -> is closing the php tag, so the output has 'function(); ?' added to it...is there something I need to change in my php or webserver configuration?
I dont think that you have mod_php enabled in your apache config file, or else you would never see the php code in the output. Here is a good tutorial on setting up php 5 in apache.
Try
<?php echo("foo"); ?>
If that doesn't work, you don't have PHP enabled in Apache.
If your're sure that php is enabled, try this one
<?php
$result = $var -> function();
echo $result;
?>
to debug it a little.. maybe something interesting will raise
Is the php enabled on server? A simple test for determining it:
<?php phpinfo();?>
Put the above line in a .php file and access it.
You could also try this:
<?php phpinfo();
Final closing php tag isn't required.
I ran into a similar problem the other day but I was using
bar ?>
instead of
bar; ?>
It turned out that the short_open_tag option was disabled in my PHP configuration.
I had the same problem with a standard XAMPP installation.
short_open_tag=On
Solved it.