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
Related
I am taking a Udemy class for WordPress. I can create a function just fine. However, when I started using the variables and array it will not work. I get a message saying there is no "php.validate.executablePath" and "php.executablePath" via settings.json.
So I downloaded the zip file of PHP 7.3 (7.3.17) VC15 x64 Non Thread Safe and extracted it to C:\php7.3. I then added the path to the settings.json: "php.validate.executablePath": "C:\php7.3\php.exe", "php.executablePath": "C:\php7.3\php.exe"
I then restarted my VSC and nothing happened. I even restarted my computer. The notification never popped up again but I still cannot run PHP. In replace of the \, I used one \, then one /, then two / but it did not change anything. I looked this issue up - found others who had the same issue - and have not found anything that has worked for me so far.
I also tried downloading the xampp but there was an issue at port 443. That's when I downloaded the PHP file directly and uninstalled xampp.
EDIT: Do I have to have something like xampp or wamp to execute the PHP? If so, I would just need to figure out how to fix that error.
Here is a screenshot of the code I used: http://prntscr.com/sahb1f
Here is a screenshot of the settings.json: http://prntscr.com/sahbk0
I am on Windows 10 x64. A tool extension for VSC costs money, which I do not want to spend.
Any help?
Thanks!
You are missing the echo in front of the $names[0] array element access.
change your line to this <p>Hi, my name is <?php echo $names[0]; ?></p> and it should work however your error to do with executablePath might be because of something else.
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.
I recently set up an AWS EC2 instance and installed Apache, PHP, and MySQL on the 64-bit Linux server using yum
Then I uploaded my php files for my contact form in /var/HTML/WWW
It displays fine except parts of my contact form are being displayed. They are PHP— the PHP tags and the code within them are being shown.
Here is a live example: 23.23.152.36
And here is a version on another server where its working fine.
Does anyone have any ideas why this is happening?
Do you have PHP enabled on your webserver? For Apache, you may need to modify httpd.conf to enable PHP.
Can you run phpmyinfo() on your webserver?
Enable short_open_tag in you php.ini
short_open_tag
Default Value: On
Development Value: Off
Production Value: Off
shorthand notation is on its way to deprication, i wouldnt suggest building code with shorthand notation anymore.
just use <?php echo ?>
You want to change <?php=$name;?> to <?= $name ?>. That's what you need to do if you want to use the shorthand notation.
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. :)
Until recently, my LAMP was working as I expected and using PHP's header() to redirect behaved according to documentation. Out of nowhere, this changed. The problem can be seen here:
<html>
<head>
<title> BLAH </title>
</head>
<body>
<p> TEXT </p>
<?php
echo "BLAH BLAH BLAH";
sleep(10);
header("Location: http://example.com");
?>
</body>
</html>
As far as I know, the redirect should not occur - but it does. I tried echoing, adding HTML, waiting to avoid any possible race conditions, all to no avail. When I access this page, no output is shown, and after 10 seconds I get redirected.
I wasn't very lucky searching the web as most people have exactly the opposite problem, nor did I find anything useful in the server logs. I haven't done any configuration changes or package updates. The people I asked were also puzzled.
I'm running PHP 5 and Apache 2 on a CentOS virtual machine.
P.S.: My first question here, but reading this site has helped me many times and I just love it :) .
Thanks Raoul, that was it.
I totally forgot I had been working on another Debian machine before the VM. And, of course, its default php.ini was different from that of the CentOS's.
Debian had output_buffering = Off while CentOS was set to 4096.
Also, PHP errors were disabled on the VM.
Thanks again, guys, it's very reassuring to know it's not an obscure language quirk or an elusive design flaw. Cheers.