for some reason my php short code isn't working after I changed my ini file. I still see the code in the source code of the browser  &lt;? include 'file/path'; ?&gt;   but I changed a few of them to the &lt;?PHP to see what would happen and those work just fine.
121999
I have installed Apache2 MariaDB and PHP7 for use on localhost, but PHP does not work. The Apache webside looks as normal while phpinfo.php only gives me a blank page. I used to install with 'apt-get install lamp-server^', but I wanted MariaDB, so I installed every single package including some PHP extensions and phpmyadmin. I have no idea of how to get php working. Any clues?   ~ # php -v PHP 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )   phpinfo.php:  &lt;? phpinfo(); ?&gt;
111364
Some guy called one of my Snipplr submissions "crap" because I used if ($_SERVER['REQUEST_METHOD'] == 'POST') instead of if ($_POST)  Checking the request method seems more correct to me because that's what I really want to do. Is there some operational difference between the two or is this just a code clarity issue?
98338
Before I jump on to the problem, let me first congratulate  and his team for the newly re-designed Stack Exchange blog. I like it very much, great job! While searching on Google, I stumbled upon  blog post of Jeff Atwood and found few broken images. There are currently four images are broken on this post, Here is one of them:    Upon doing an inspect element on one of the broken image (same goes for all other broken images on the post), I found out that it is currently pointing to: https://blog.stackoverflow.com/wp-content/uploads/stackexchange-genuine-example11.png The newly re-designed Stack Exchange blog is now moved to a new location:  and the old blog URL i.e.  has the correct mapping of URL redirection (also called URL forwarding) and works perfectly. But, the problem lies in the latter part i.e. /wp-content/uploads/ directory structure does not exist anymore at the new blog location. I read the Jon Chan's  post (nice writeup! btw) where he talks about his custom Python script. Here is the relevant excerpt taken from that post:  I wrote a Python script to go through all the imported posts, looked for references to WordPress hosted content, download all the static assets into images/wordpress in the repo, and changed all the links to relative paths on Jekyll. Worked surprisingly well.  In other words, all of the old /wp-content/uploads/ static assets is now resides under the /images/wordpress/ directory at the new blog location. So, Jon's find and replace script should have worked (which it did for the most of the part) as intended to be but apparently it did not catch few of them. At least on  blog post and few other like ,  or . We could possibly have more but these are the ones I have found so far. I believe it's a minor bug somewhere in the script and could be fixed with few lines of code tweaking. Also, the static content link mapping problem would not have occurred at all if the directory name was unchanged as the URL redirection (as stated above) would have taken care of it. But, there must a reason for this change. Upon investigating further, I found out that the issue with broken images does not end here. They will still appear as broken even if Jon's script replaces the path to the correct one. Because the images have not been uploaded (or copied) to the blog's new /images/wordpress/ directory at all. They are missing! For example, try clicking on the following link: ## I replaced old dir. path /wp-content/uploads/ to the new /images/wordpress/  So, in a nutshell, in order to fix this broken images link problem, we need to make sure that not only they are pointing to new path i.e. /images/wordpress/ but also do exists (i.e. uploaded) at the blog's new location. Please fix this at your earliest.
23308
I have about 10 php.ini files on my system, located all over the place, and I wanted to quickly browse through them. I tried this command:  locate php.ini | xargs vi   But vi warns me Input is not from a terminal and then the console starts getting really weird - after which I need to press :q! to quit vi and then disconnect from the ssh session and reconnect to have the console behave normally again.  I think that I sort of understand what's happening here - basically the command hasn't finished when vi started so the command maybe hasn't finished and vi doesn't think that the terminal is in normal mode.  I have no idea how to fix it. I have searched Google and also unix.stackexchange.com with poor luck.
119894
I was stuck up with the error   directive 'register_globals' is no longer available in PHP in unknown on line 0   when tried to check the php version using "php -v" after enabling register_globals in php.ini file. I am not getting any php version info by doing so. Instead it throws the above mentioned error.After turning off this option, php info works quite well. It is very essential for me to have register_globals to be turned on.How can I have this corrected.  my php.ini is as follows:   ; Default Value: None ; Development Value: "GP" ; Production Value: "GP" ; http://php.net/request-order request_order = "GP"  ; Whether or not to register the EGPCS variables as global variables.  You may ; want to turn this off if you don't want to clutter your scripts' global scope ; with user data. ; You should do your best to write your scripts so that they do not require ; register_globals to be on;  Using form variables as globals can easily lead ; to possible security problems, if the code is not very well thought of. ;  register_globals = On  ; Determines whether the deprecated long $HTTP_*_VARS type predefined variables ; are registered by PHP or not. As they are deprecated, we obviously don't ; recommend you use them. They are on by default for compatibility reasons but ; they are not recommended on production servers. ; Default Value: On ; Development Value: Off ; Production Value: Off ;  register_long_arrays = Off  ; This directive determines whether PHP registers $argv &amp; $argc each time it ; runs. $argv contains an array of all the arguments passed to PHP when a script ; is invoked. $argc contains an integer representing the number of arguments ; that were passed when the script was invoked. These arrays are extremely ; useful when running scripts from the command line. When this directive is ; enabled, registering these variables consumes CPU cycles and memory each time ; a script is executed. For performance reasons, this feature should be disabled ; on production servers. ; Note: This directive is hardcoded to On for the CLI SAPI ; Default Value: On ; Development Value: Off ; Production Value: Off ; register_argc_argv = Off  ; When enabled, the SERVER and ENV variables are created when they're first ; used (Just In Time) instead of when the script starts. If these variables ; are not used within a script, having this directive on will result in a ; performance gain. The PHP directives register_globals, register_long_arrays, ; and register_argc_argv must be disabled for this directive to have any affect. ; auto_globals_jit = On
117376
My php is weak and I'm trying to change this string:  http://www.example.com/backend.php?/c=crud&amp;m=index&amp;t=care                                    ^   to be:  http://www.example.com/backend.php?c=crud&amp;m=index&amp;t=care                                   ^   removing the / after the backend.php?. Any ideas on the best way to do this?  Thanks!
105801
I have been trying but its not working.  but if i try   &lt;?php echo do_shortcode("[mimo]"); ?&gt; &lt;?php echo do_shortcode("[mibaby]"); ?&gt;   it will work fine.  But to apply it in post content using [mimo] [mibaby]  it won't work.  Here is the Functions i am using...  function wpb_custom_new_menuw() {   remove_filter( 'the_content', 'wpautop' ); } add_shortcode('mibaby', 'wpb_custom_new_menuw');    function wpb_custom_new_menu() {   remove_filter( 'the_excerpt', 'wpautop' ); } add_shortcode('mimo', 'wpb_custom_new_menu');
97704
I just visited  and for me it shows no results. Has something broken?   The problem occurs for me , but oddly not on some other sites I've tried, such as  or .   I have tried pressing Ctrl+F5 many times, but as yet no success in solving this. This has now been broken for days, leading me to believe that caching is not the culprit.  I've since noticed that the problem goes away if I add some tags as favourites (e.g. ). But I prefer to have no favourite tags, so the problem remains for me. What's odd is that I don't use favourite tags anywhere on the network, so the fact that the ServerFault and Programmers tab works for me is a mystery.
89561
I recently downloaded OpenSUSE OS version 11.4 from the site to use it as a server..In order to do that I downloaded the server edition that has Apache/2.2.17 and PHP5 downloaded by default.....Ok till now it is fine  Now I started the Apache successfully and put a test.php file in the documentRoot directory. test.php contain only &lt;?php phpinfo() ?&gt;  Then using my browser I typed http://localhost/test.php and here was the problem  the browser didn't display what phpinfo() should display, instead it asked me whether I want to open or save test.php...which is driving me crazy.... I googled a lot but no solution  THis is /etc/apache2/conf.d/php5.conf  &lt;IfModule mod_php5.c&gt;     AddHandler application/x-httpd-php .php4     AddHandler application/x-httpd-php .php5     AddHandler application/x-httpd-php .php     AddHandler application/x-httpd-php-source .php4s     AddHandler application/x-httpd-php-source .php5s     AddHandler application/x-httpd-php-source .phps     DirectoryIndex index.php4     DirectoryIndex index.php5     DirectoryIndex index.php &lt;/IfModule&gt;
16453
Friends, sometimes I had to create a self-contained PHP script. That means the PHP script could have any files within it due to some encoding/decoding algorithm, like Base64. For example,  is a Base64 encoding of this tiny image:   Of course, in this particular case, PHP can handle that huge encoded string because it has a bundled  function.  I was wondering if this idea is possible to achieve somehow in TeX/LaTeX. I need to point out that I'm just curious on this subject, not that I want to embed whatever in code. Besides, as you noted, the encoded string is huge, so that'd surely make people cry blood.  One possible solution I see is if somebody implement an encoding/decoding algorithm in TeX/LaTeX, like \base64_decode, so it would be possible to use something like this: \includegraphics{\base64_decode{\myhugeunreadablestring}}. Sorry for the acid trip ticket, but I'm really curious on how this insane code would work. =)
16852
I posted . I think it was probably a better fit for the , but for the reasons I cited in my question, I posted it on SO.     I deliberated whether to post this on code review or here. I came to   the conclusion that it is a straightforward question about PHP and   with the number of supporters here, it would likely get an answer, as   code review is slow and the question has a greater chance of not being   answered.   The answers and feedback have been amazing and, I believe, will add another good resource for visitors to the site.  I have attempted to be active on the Code Review SE, but there is not a great deal of interaction.   Can anyone suggest a way to support our Beta sites and yet still get good answers?
35211
I have an odd problem...I'm using a documentation generator which generates a lot of output like docs/foo.php.html. It's XHTML, and thus contains &lt;?xml...&gt; tags at the beginning of file. The problem is, Apache has somehow decided to run it through the PHP interpreter, even though ".php" appears in the middle of the filename, and not at the end. This, in turn, triggers a PHP error, because it sees "&lt;?" as the command to start executing PHP code, and immediately gets confused by the "xml..." which follows it.  How do I configure Apache to ONLY execute .php files and not .php.html files? The string "php.html" does not appear explicitly anywhere in my Apache config files. There is a line "AddHandler php5-script .php", but I don't see how that would also include ".php.html" files.
82741
Has anyone used  and/or PHP namespaces within a plugin or theme?  Thoughts on using them? Any harm? Pitfalls?  Note: namespaces are PHP 5.3+ only. Assume, for this question, that you know you'll be dealing with servers that you know have PHP 5.3 or greater.
4579
I have a phpinfo.php file which I am trying to run by browsing to it using browser but the browser downloads the file instead of executing it.  phpinfo.php  &lt;?php    phpinfo(); ?&gt;   I followed following  post, added following lines to my /etc/apache2/httpd.conf and restarted apache but invain. phpinfo.php still gets downloaded.     AddType application/x-httpd-php .php> .phtml   AddType application/x-httpd-php-source .phps   Have I added these line to the correct file?  On an openSuSE forum following was mentioned. I followed this too but still no success. Same problem is persisting.     In case the browser wants to save your   php files instead of displaying the   content, you should enable php support   in the /etc/apache2/mod_userdir.conf   file. Add the following line to it,   just after the  line and restart   the server.      Include /etc/apache2/conf.d/php5.conf
114665
When I want to execute a php file it's displayed as text in my browser.  I have a VPS at Hostinger I installed Ubuntu 18.04 with Webmin and LAMP(installed automatically).  I checked the installation see below.  apache2 - v and php -v gives me: Apache/2.4.29 and PHP 7.2.24-0ubuntu0.18.04.6  So everything seem to be installed correctly.  My default folder is /var/www/html/ I do not us short tag in my code.  I try to lunch a file called phpinfo.php with content:  &lt;?php phpinfo(); ?&gt;   And plain text appear on the page.  If the file begin with html code it's correctly rendered, even with a .php file. But the php part is not executed. e.g:  &lt;!DOCTYPE html&gt; &lt;html lang="en" dir="ltr"&gt;   &lt;head&gt;     &lt;meta charset="utf-8"&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;h1&gt;Hello&lt;/h1&gt;   &lt;/body&gt; &lt;/html&gt;  &lt;?php phpinfo(); ?&gt;   Render :  Hello  But  &lt;?php phpinfo(); ?&gt;  &lt;!DOCTYPE html&gt; &lt;html lang="en" dir="ltr"&gt;   &lt;head&gt;     &lt;meta charset="utf-8"&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body&gt;     &lt;h1&gt;Hello&lt;/h1&gt;   &lt;/body&gt; &lt;/html&gt;   Render the code as plain text.
15283
I have a php file which I will be using as exclusively as an include. Therefore I would like to throw an error instead of executing it when it's accessed directly by typing in the URL instead of being included.  Basically I need to do a check as follows in the php file:  if ( $REQUEST_URL == $URL_OF_CURRENT_PAGE ) die ("Direct access not premitted");   Is there an easy way to do this?
73925
Earlier today a question was asked regarding .  The top answer, at time of writing, suggests in PHP just using htmlspecialchars and mysql_real_escape_string.   My question is: Is this always enough? Is there more we should know? Where do these functions break down?