i have php 5.3.1 installed on apache2 in ubuntu 12.04 server .
my site was working fine untill last week when i found some of the files were missing and website was not showing.I uploaded site again on server and now when i browse any php pages it shows a blank page and also when i try to see the source code in browser for the blank page it dosnt show any source code.the html files are all showing up.
i dont think it is the server or appache2 probelm as i have other site with php on the same server working fine.
i checked with php files they are alrite.checked with the htacces.txt and that is same as the other working site on the same server.
can anyone here help what the problem could be.
thanks
Rida
Check error logs in /var/log/apache2/error.log
I got the same problem while installing a third party LAMP application and the cause was missing php5-mysql package.
Hope this helps others.
Sometime this white screen may occur because of the php page that is included by include() and include_once() functions, which may have some error or any syntax error that are not reported by the php server.
This happens because the included php page are executed first before the actual php page and if any error that is present in the included file occurs that suppresses the error catching then further php codes are not executed and a blank page is displayed.
First try to find that which dependent file has the problem by // toggling each include() or includ_once() one at a time.
After the culprit dependent file is found try to check it for the errors.
In my case this happened when I un-installed Zend using its uninstall.sh, I then needed to edit the Apache config /etc/apache2/sites-enabled/000-default.conf to remove any references to Zend Server. I did restart Apache, but restarting the whole machine helped to revive PHP bindings.
In my case I find out that the include_once() function which I put on the top of the page was the problem . I red the answer by Gaurav Kispotta , that is where I got the tip . so if you have the same problem first comment that out , maybe even the entire code depending on that include .
You should never ever use require_once or include_once.
It will burst your server memory.
Just go with include or require.
php is a server side language so viewing source from browser will not yield any result if the whole codes are surrounded by php tags. Download the files from the server using an ftp client and try to open in an editor to see if there are still codes in it.
Related
I have begun learning PHP using an eBook. The following strange results are happening: Per the book I have created two simple PHP files. They are named phpinfo.php and hello.php. Both files show in the user root directory. Both files show when I use the ls command in my mac terminal.
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible? Could an internal file mistake cause this?
Thanks
Thank you all. It was suggested that it would be easier to delete everything including the app and start over. So I did and then downloaded MAMP. That worked.
I have a Windows server 2003 service pack 2 installed on my virtual host.
This is my server settings:
IIS version: 6.0
PHP version: 5.3.28
My website engine: Wordpress
When I try to open my site inside my browser, I see lot of php code inside browser. Other pages works fine but the first page is full of php code.
What is the problem?
Edit:
I have this site working fine on my local machine. The error is just inside the main server.
I changed short_open_tag to On but nothing changed.
Now I'm trying to remove the wordpress and install it from scratch.
Probably a problem of pairing tags.
<?php Instructions ?>
Check each start and end tag. If you don't see an error, try do copy the code in a draft, delete all the page and then reconstruct it part by part to see where is the problem.
Hope this technique will help you.
Did you follow all instructions in order to activate the IIS FastCGI module, as shown on this page ?
http://www.php.net/manual/en/install.windows.iis7.php
The problem is solved just by removing wordpress and installing it again.
I have installed XAMPP server on my system to be able to use PHP. But after installation, when I run any php script on the browser it does not run. I do not see any ouput. No checking the phpinfo() from local host I see that version 5.3.5 is installed
Even when running a a simple php file like where I echo a line;
I do not see anything on my browser. So, my question is do I need to make any configuration changes to my browser or system to get PHP running.
Put your scripts into /XAMPP/htdocs and then point your browser to: http://localhost/your_script.php
Your best bet is taking a look at your log files, and perhaps turning error reporting on. Put a simple script in your webroot that simply echo's a string, for example:
<?php echo "Hello World!";
with the above there is very little that can go wrong. Work from there. Take a look at your phpinfo, and see where your log files are located. Search for
error_log
for the path to your PHP error log file and maybe see if
display_errors
is on.
This is something that has a multitude of possibilities that can be the cause of your problem.
install phpxx-php which is used for creating dynamic web sites
check version of php using php -v
if you have php55 then use:
yum install php55-php.x86_64
Ensure to save file as .php ; e.g. index.php and not index.html
From Troublespy here are the reasons why php might not be working in the browser:
You did not download a local server
You are using the wrong version of php
You put your scripts in the wrong directory
You have a php error and the error didn't get printed
Your php code is wrong or incomplete
Make sure you check all reasons.
I have an index.html in my wampserver www directory. On this html, there is a link for a user to upload file. When I hit the link, I select files to upload but instead of the uploadmanager.php which i have tested in my eclipse debugg environment to work, it displays the some part of the code on the web page without doing anything thing. This is not what I expect. Can someone please tell me what is wrong? Thank you.
sound like you are using php-short-open-tags (<? instead of <?php) without enabling this in your php.ini. change your php.ini or use the standart open-tags to solve this.
Are you sure you enabled PHP in WAMP?
Try creating a new uploadmanager.php file directly in wamp/www (or whatever subdirectory) and paste the code from your tested uploadmanager script into the new file. Then try to run it in WAMP.
I think it is a permissions problem. I copied an index.php file into a c:/wamp/www/subdirectory and it only displayed the code. Once I created a new index.php file and pasted the contents of the old file into it, it worked perfectly.
Are you posting to the uploadmanager.php page? Are you getting an error or just seeing the code? Can you post the code from the index.html page that handled the form and the part of the php code you're seeing for us to look at?
Every now and then I have Apache serving the .php as downloadable files instead processing them on the server, but only with random requests.
Some reasons, why this might happen, are
PHP misconfiguration
PHP-files in a directory without execute rights
wrong content type sent
timeout from script execution
In my situation the last bullet is the most dangerous, but luckily it seems to show up only immediately after modifying some of the .php files. I haven't tracked the problem any deeper yet, but it seems to relate some filesystem level operations (as the disk I/O is a bottleneck) and presents itself only in testing env.
All PHP pages are all running just fine on my site, except for one for which Firefox says "You have chosen to open checkpage.php which is a PHP script" and then wants me to select an application with which to open it.
The site is running PHP Version 5.2.10 on Centos 5.5.
I'm using exactly the same code on another site (PHP Version 5.2.10-2ubuntu6.4 on Ubuntu 9.10) and it's fine.
I've Googled myself silly trying to work out what the issue is!
Does anyone have any ideas why this one page might be causing a problem? The page is about 200 lines long but I'll post it here if it'll help...
All thoughts much appreciated
Mike
PasteBin: http://pastebin.com/A6uNj9CN
Last time I had this problem, I just installed PHP on my server. Worked fine after I rebooted it. Hope that helps.
Does the file that's downloaded have any content? Or is it zero bytes? It's possible something's causing PHP to puke on that script before it sends out any headers and so the browser has no choice but to interpret it as a download of a .php file with no content.
Check the server's error logs (and PHP's as well) to see if anything's showing up in there.
Is there a separate htaccess in the folder that stops apache from sending it to php or changes the mime-type? Does the file have a different extension than other files on your site?
Use something like a packet sniffer, or HTTP Debugger, to see what headers are actually sent by the webserver. That will help you, and us, debug the issue.
Call curl -I http://blahblah/foo.php and look at the content-type header. That will help point you in the right direction. Is it text/html or something else?
Try to change the permission of the file from 775 to 644 or try changing the permissions. Note: change to the correct permission type to avoid public viewing of the files