I am fairly new to creating websites and I have done a website that I did in a sandbox server on my personal computer, it works brilliantly, but as soon as I try to put it on my companies server to go up on the internet it doesn't work anymore. What the site does is it takes fields from an html form and then does a sql search of a database that I set up and works fine. Then after the user is done with the form they hit submit and the sql is run and results are returned to the same page. The form action="" and then the results are returned. I am not sure if the companies server has php installed, but I don't know if that would be a problem or not because the browser should still be able to display the php code. I have no problems with the html form, it is just when I hit submit that the page is returned and nothing is displayed.
Any help is welcome.
"I am not sure if the companies server has php installed, but I don't know if that would be a problem"
It is. Browsers can do nothing with PHP. Maybe you shoud register for a free hosting provider and learn the basics of hosting there.
PHP is a server-side language (i.e., it runs on the server, not the user's machine). Therefore, it must be installed on the company's server for any PHP code to execute properly. Browsers cannot interpret PHP code, and moreover PHP code is executed before the browser even receives any information (PHP: Hypertext Pre-Processor). Check that the server has PHP installed before you continue. (Also be aware of versions and features. For example, to use many new PHP features your server must be running PHP5.)
If you find that PHP is installed: Check your PHP syntax; make sure that no headers are sent after text is sent to the page; and make sure that there are no loops or anything in your code that could cause the script to continuously run without printing to the page.
Also, since your page is returned when you hit 'Submit,' but no new information is shown, make sure that there is not a problem with the MySQL configuration (e.g., incorrect password, query syntax, etc).
First you have to be sure that server has PHP installed.
make a file named phpinfo.php with this line
<?php phpinfo() ?>
and call it.
If it won't print out PHP config, you have to install PHP first.
Otherwise the problem most likely in the form of PHP tags, and you are using <? instead of <?php.
To solve, you can either change tags or set short_open_tag to on in the php.ini
According to your comment
when I hit submit that the page is returned and nothing is displayed
I am going to make an assumption that you are getting a blank page. If that is correct, then I am also going to follow that up with the assumption that PHP is installed, there is an error in your script (my guess is the database connection), and that the error is not being displayed.
Add these lines to the top of your page and post back with the result:
error_reporting(E_ALL);
ini_set('display_errors', '1');
Ya I think there is a problem in your database connection.First run your connect file whether it is showing some error or not.Plase add this line to your page:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
And please modify your php.ini file with this line:
display_errors = on
Related
Trying to insert a automatic-messaging system in roblox, but its not working.
(Script was to complicated to post here apparently)
http://pastebin.com/tbFRY1Az
Whenever I go to
mywebsite.com/newMessage.php?id=2262712 and it doesnt work
anybody know what the problem is?
I'm not sure, but Roblox has a message limitation system. This prevents message bots from spamming inboxes. Scroll to the bottom of this Pastebin post and you will see a javascript PM bot. It works to the extent of the anti-spam PM system that Roblox has.
My guess is that php-curl is not installed/enabled
add following lines to the start of the file (after
ini_set('display_errors',1);
error_reporting(E_ALL);
This will probably show any errors occuring(depending on the server config).
If it doesn't display any errors, create a file with this code:
<?php
phpinfo(8);
?>
Then open it in browser, it will display all modules enabled, search for "curl", if it's there, then you have to check your error logs to see what's wrong with the code, if not, then you have to install php-curl to get it to work(or rewrite the code so it uses another method of fetching data).
UPD For some reason you don't have curl_init, add this on line 8(above all curl_setopt's):
$ch = curl_init("https://www.roblox.com/newlogin");
Also, replace
htmlspecialchars($_GET($key));
with
htmlspecialchars($_GET[$key]);
I'm trying to run a php script on my website through my file manager but it just shows a white blank screen. I ran a couple of test php scripts on my file manager and runs well. The php script that runs a blank screen has been tested offline with WAMP and works fine, The php script involves connecting to a database which it does, uses simple_html_dom for web scraping and inserting to a database. Can someone please help. Surely if it works offline it should work online no error messages are showing
Turn on your error reporting first :
error_reporting(E_ALL);
It might be occurring because you have switched off the error_reporting and the connection is not being successful.
Check if your database connection credentials are correct.
If the problem still exists, refer to this page :
PHP Blank Screen - Solutions
Make your error reporting on by
error_reporting(E_ALL);
Also, please check php's error log file.
Every page crash is printed there.
Generally, in php folders of WAMP, XAMPP.
For XAMPP in Windows, the file location is:
xampp\php\logs\php_error_log
I have this login script working just fine on one server but not on other and coudn't figure out why.
include_once 'include/processes.php';
$Login_Process = new Login_Process;
$Login_Process->check_status($_SERVER['SCRIPT_NAME']);
and the third line won't display the server status, the code display on my web page, and didn't go to main page. any idea may cause the issue.
thanks.
The third line isn't working, most likely, because you have a Fatal Error being generated somewhere as a result of this line:
$Login_Process = new Login_Process;
Either use ini_set to change the errors being displayed, or set up an error log. You basically need to know what the errors are, and then you can deal with them.
It could be many things, some of which may be the configuration.
The first thing I would check is the PHP version. Make sure that nothing in your scripts or your php.ini file conflict with the version of PHP you're migrating to.
After that, go through the functions you're calling and make sure nothing is deprecated in PHP on the second server.
I created a captcha just now, and it works PERFECTLY on my own server. On the school's server, it doesn't generate an image. Why might this be? The difference in code is one line.
Edit: Originally, it was working, but I deleted the directory by mistake and I do not know why did it suddenly work in the first place.
Update: I var_dumped() everything and everything is being set correctly.
Source code on school server:
Update: I figured it out! I'll post the answer later.
Make sure that GD library is enabled in your school's server.
Also try putting these lines on top of your script to see if there are any errors:
ini_set('display_errors', true);
error_reporting(E_ALL);
It is just useless to direct such kind of questions to SO.
There must be thousands of reasons.
And, of course, without access to your server and environment, nobody can say, just by looking into working code.
The only person who can answer this question is you yourself.
With help of your server, of course.
You must ask your server for errors.
ini_set('display_errors',1);
error_reporting(E_ALL);
but sometimes (in case of parse errors for example) this won't work. In this case you have to either set these params via .htaccess or check web-server's error log.
Also, you have to do something.
At least add some text output in the script to be sure it being executed.
print out variables using var_dump() to ensure thy contain right values.
Add an intentional error to ensure you CAN see them if any.
Do something, don't sit watching code!
Some more info on how to help yourself: http://www.ibm.com/developerworks/library/os-debug/
The php script is calling four functions that scrape different websites for data.
$returnData[0]=getWebsite1Data($description);
$returnData[1]=getWebsite2Data($description);
$returnData[2]=getWebsite3Data($description);
$returnData[3]=getWebsite4Data($description);
The script displays the web-page correctly if I disable the call to any one random function.
That makes me think its a resource problem. If it is a resource problem how do I correct it in Xampp. I've tried unsetting the variables but that didn't work either.
Make sure Error Reporting is set high enough in php.ini
Check your phpinfo and see what your "memory_limit" is. Try doubling it in your php.ini.