I have some PHP files developed on a Linux machine, which I am now working on on a Mac (OS 10.8.2). Pages were not showing up correctly on the Mac, even when they were showing correctly on the linux box. After some investigation, I found that it was because it wasn't recognizing syntax like this:
<?=$var ?>
Anything starting with just a <?, rather than a <?php (not just the var shortcut above, any block of code) is being interpreted as plain text, rather than PHP. On the Linux dev box and production server, the shortcut <? syntax is recognized just fine. I assume this is a configuration thing that I missed during setup, so what did I miss? Can I configure my Mac to recognize this syntax?
The mac is running PHP 5.3.15. The dev box is running an earlier 5.*. I don't know the version on the production server.
Either upgrade to PHP 5.4 (which supports <?= .. ?> all the time), or enable the "short tags" setting in the php.ini file.
These are called short tags.
Edit your php.ini file and set:
short_open_tag=On
Related
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.
Hello i am trying to use php's proc_open() function on my personal Windows server, but i am getting error like, php warning : proc_open is disabled for security reasons.
But in php.ini i have commented disable_functions and removed anything like blocking these functions. Still getting these errors.
What could be wrong?
I am using ZPanel and Windows 2008.
The problem lied in Zpanel's httpd-vhosts.conf file, actually i have a Windows 2008 Server with ZPanel and suhosin installed, so in httpd-vhosts.conf file there was php suhosin.func.blackblist = proc_open,
so i commented this line, and restarted APACHE from services, Now its working flawlessly fine.
Thanks everyone for taking time to read and answer!
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. :)
The code attempts to grab a test page for example Yahoo.com in this case. I am outputting the var_dump
http://jinimatics.com/test.php (this works)
http://jinimetrix.com/test.php (this does not)
(Curl is installed on both servers along with fairy recent Lamp Stack)
Try to compare whats installed and version differences.
check your server settings with phpinfo();
then you can change settings in php.ini
I'm having some issue with var_dump.i'm using xampp 1.7.3 on windows.
I think in previous version i could output a variable with var_dump without print "<pre>" print "</pre>" firebug is not installed on my firefox and i'm not using xdebug.
Formally i have even red colored and nicely formatted output.Now it's completly unreadable.Can anyonw give me a tips n how to correct that.And html_errors is on from what i saw in php_info.thanks for reading this.
You were using Xdebug before; you're not using it now. Without it, there are no colors, and there are no HTML line breaks (use nl2br, change the Content-type header to text/plain or put the output in a <pre> block).
See the "Variable Display Features" on the manual of Xdebug.
Un-comment this line in you php.ini file.
zend_extension = "D:\xampp\php\ext\php_xdebug.dll"
This topic helped me at the time I was working in PHP5. With a fresh install of Xampp (PHP 7+), xdebug is no longer installed. It must be done manually. Below the explanations :
Goto https://xdebug.org/wizard.php
Make a phpinfo(); on your project and paste it in the textarea on the xdebug website
It returns some informations on your system like Xdebug installed: no
Follow the instructions in the bottom of the results page
After the manipulation, if you check again your phpinfo();
This time we get Xdebug installed: 2.6.0. xdebug works !