I was writing some PHP code for my web application recently. I was trying to test sending an e-mail from a contact form on a local server (by using a variety of methods, including SendMail). None of them worked (though it may be code-related but I don't know yet). I basically restarted Apache/MySQL several times throughout testing. At one point when I was changing the configurations for SendMail, I was unable to re-start Apache & MySQL after stopping them. The icon remained red. Every time I try to start Apache, nothing would happen and the icon still remains red. I tried doing it manually from Services but it's giving me an error. It has always worked in the past, so I am not sure what's happening now or whether or not changing some of the SMTP configurations on php.ini or sendmail.ini and installing these mail server tools messed something up?
Anyone have any suggestions on how to fix/troubleshoot this? I am pretty new to server-side development. I appreciate the help!
It could be a hundred different things, do what welshGaz said and check your logs. If you're still stuck after that, you have the following options:
Uninstall/Reinstall WAMP
Try an alternative to WAMP such as XAMPP
Spin up a virtual environment using virtual box and ubuntu
Spin up a server on Amazon Web Services, Heroku, etc.
These are options are of the last-resort variety, but if you're in a pinch and don't have time to troubleshoot, one of these options might be a faster way to get back up and running.
I think the first place to go would be the WAMP logs. On Windows these can be found under the root_application_install_directory/logs. For example on my Windows 10 machine I can find them under C:\wamp64\logs.
You should find all logs from Apache, PHP etc. placed here. Having a look at those may help you get closer to the cause of your issue and why the server is not starting.
Related
I'm having a frustrating problem with all the forms of a Symfony2 website for a couple of days now.
In fact, every form are OK when my coworkers and I work on the project on our local computers (we're all on PC, Windows 7 64bits or 8.1 64bits, using WAMP 64bits too and having PHP v5.4 and Symfony v2.4.3 set on it). But when we want to test on our distant dev environment, there is no form that works properly: in the Symfony profiler, the problem seems to reside in the fact that no POST parameters go through the process of submitting the form. But once again, this situation only appears when the project is hosted on the distant server.
I have checked the configuration of the server because I thought it was a config issue, but everything looks just the same as what we have on our WAMPs.
I have also checked my config.yml file, just to see if something could be wrong in it, but I can't see any kind of "local-only" configuration.
Moreover, I've found a very few people telling that they encountered the same problem on the internet, but they never explained how they did to go through that.
As I said, I am currently on this issue for days now, and every suggestion and clue will be very welcome!
Thank you for your time,
[Edit 1] This is a complementary information: the only difference between our local and remote configuration is that, on the remote server, the "short_open_tag" thing is enabled and, due to some provider restrictions, can't be disabled.
So I enabled it on my WAMP (and restarted it) to see if to see if the forms would keep working. And they do work with short_open_tag enabled on my local machine, so I assume that the problem is not from there.
I currently have CF 8, and I want to be able to use PHP code also, but in a separate environment. I don't want CF and PHP code intermingling.
I have downloaded WAMP in order to accomplish this, but I can't get it to start (it's just Orange in the task bar).
Why is WAMP in the Orange? On previous installations, I start it, and it turns green. Does this have something to do with CF? When I go to localhost, I go to my CF environment. How do I get to the WAMP localhost?
I have ColdFusion and PHP running on my Windows development machine and my production Linux server. I do not recall having a whole lot of trouble doing so either.
Before the StackOverLords flag this question for being too broad, try narrowing the focus of the question and you will be more likely to get answers that will help you.
You could use a virtual machine as your separate environment if you are really concerned - In which case it would be the normal installation procedure.
However, I cannot think of any reason why having them both installed together would cause you problems (I have had numerous set-ups with them running in parallel on both on Linux and windows systems with Apache and IIS)
I used to have the same issue. I believe what I did was set the CF application server to start manually with Windows as a service. Try disabling CF, restart the computer and if WAMP is running ok you should be able to start CF without issue. IF that works you could probably autostart with delay to avoid having to do it manually each time. I generally don't work in both environments at the same time so it ends up just using extra resources anyway.
I inherited a website that recently changed hosting accounts. Both were on virtual servers. On the new account several of the php scripts have stopped working. They were working before the change.
I've already tried changing register_globals and that didn't work.
What other types of settings can I try changing? Things that might stop scripts from working on a different server.
I know this is generic, but I just need some ideas of where to start to troubleshoot the problem.
Thanks.
Check the version of php that the new server is running by echoing phpinfo(). That sometimes tends be the case, if you are not missing other things such as file paths and others.
i don't know how to say that in technical terms. and i think this is the reason to why i cant get good answer from Google.
i have xampp on my local winxp machine. i use it for developing websites locally then upload these files to my clients shared hosting accounts.
the problem that in 2 years i have always found differences between how xampp works and how the web server work.
some code work locally but dont remotely and the opposite. also flash behave differently on xampp than the remote web server.
is there is a way i can get the server configuration and use it with xampp like get the server php.ini and use it with xampp?
In fact XAMPP may behave different than your production system's web server.
This might be annoying at first, but it is definitely manageable.
Some thoughts:
Run
<?php
echo phpinfo();
?>
on both systems and check different features.
If a feature of PHP is marked as experimental, just drop it.
In case you need to deploy on different production servers, prepare a script called grabProperties.php and add code which checks essential properties you know to be in use. Output the result in some normalized way, so you may use another script to compare results and prepare a nice report.
Certain features activated in XAMPP are not enabled on most web hoster's server - e.g. Flash support. Before using these features, first ensure they are present on your production system.
You are always free to change php.ini. Thus, you may enable or disable modules in such a way, that you dev system mimics your production system's settings.
I wonder, that Flash problems relate to PHP itself. More likely, problems relate to erroneous code.
That said...
I do write PHP for quite some time. Upgraded XAMPP on dev and Apache/PHP/MySQL on production system several times. But not a single application failed to work after the upgrade.
Several times, I moved from dev Windows and production Linux to dev Mac OS X. Even there, everything worked fine immediately.
Needless to note, that not a single line of code needs to be changed between dev and prodution systems.
The essential point to to write high quality code is based on a defensive style.
Check as much input parameters of as much methods as possible (see assert()).
Log all errors to a log-file and visualize it using your admin backend (see set_error_handler()).
Use type-hints as often as possible (see type-hinting)
Set the maximum error level and code in such a way, that not a single warning appears.
Still unsatisfied?
In case you are still unsatisfied with XAMPP, prepare a virtual machine with VirtualBox, install some Linux edition and enable apache, mysql and php.
If your hoster's server is on linux - which is very likely - there should't be a big problem configuring the virtual LAMP server in a similar way.
I installed Apache, PHP and Apache to be used with PHP. The Apache server was never pointing to localhost, and the localhost always pointed to IIS instead of Apache.
Interestingly, I had a seperate website (explicitly named with somename.com, running locally with default port 80 and upon firing the Apache server the site was being used (instead of localhost) for displaying the Apache-based folders.
However, both are not able to process PHP and I've been trying to get this to work for almost a day now (I thought it wouldn't be too rough on me initially)
So since no matter what change I've made:
Apache configuration to use specific IP, rather than port 80.
Restricted IIS on specific ports, rather than port 80 and all local ports.
Disabled IIS via 'Services' in Administrative Tools.
Forced restart of 'Apache Service' via 'Services' in Administrative Tools (this threw an error). But restarting it via the Apache Http server menu options seemed to work fine.
Installed XAMPP so it will run directly (not sure if I'm using this wrong though, it did seem to start up but again localhost was never pointing to the Apache's 'htdocs' like it's supposed to.
PHP was added to Apache as well as downloaded (both .MSI, .ZIP installed for BOTH Apache and IIS).
No option seems to make the PHP process, it just displays the source code (like in HTML you have the html, head, body tags displayed on the web site instead of actual HTML ). It's pretty frustrating that:
After different attempts to disable IIS, I've not been able to.
Apache has everything configured to run PHP (I have actually done this on a Macbook once a long time back, don't remember if I missed anything though) but it doesn't work.
No errors are thrown, except that localhost is not displayed (I stopped the sites that were on IIS, and localhost points to IIS, any attempts at accessing either the IIS specific folders, or the Apache sites are not working).
Also, several attempts of getting PHP to work on WINDOWS 7 (yes in capital letters) has failed as well. Please help!!! Let me know if any specific details may help in troubleshooting, and I will be glad to provide them.
Well, firstly, apache is obviously now running as you can see the php source.
If you only see php source, assuming the PHP file is of a .php extension, you can boil it down to almost certainly the mime type hasnt been set.
in your apache config there will be lines such as:
AddType application/x-httpd-php .php
if not, add it.
If that doesnt work it would really seem it hasnt heard of PHP at all.
having not got apache on win7 to hand, theres probably a loadmodule line missing, while this is aimed at vista, this may have some ideas.
http://www.wikihow.com/Install-and-Configure-Php-5.2.5-and-Apache-2.2.8-in-Windows-Vista
Just use some prebuilt solution....
I use WAMP, But there are loads out there.