How to fix apachetl not finding apache instance and stop the server? - php

I am currently running macOS High Sierra version 10.13.6.
I am trying to stop an apache server from running on my localhost port 8080. This is what I get when I load localhost:8080 in my browser: Apache / PHP server screenshot. From research and the help of others in:
How to kill Apache / PHP server running on local host port 8080? I believe that my apache installation is broken because when I run the command sudo /usr/sbin/apachectl stop, it says: cannot find specified service.
I do not ever recall installing apache or starting the server, but it could have something to do with postgres. Is there a way I can try to fix my installation so that I can find the apache instance and stop it when I run sudo /usr/sbin/apachectl stop? If it is not an installation error, I am open to hear other ideas.

The EnterpriseDB logo on the screenshot kind of hints that this is not a standard installation of Apache, but something bundled together with EnterpriseDB, and it seems to have its own control scripts.
If you are not using it and do not plan to use it in the future, the most sensible thing would be to uninstall it completely.
If you just want to stop it, try running sudo /Library/PostgreSQL/EnterpriseDB-ApachePHP/apache/bin/apachectl stop
But if you only stop it, most probably it will start again automatically after next reboot, so if you're not uninstalling it, you can at least disable it. Here's a post on SuperUser (which is where you should've asked this question instead of SO, btw) where it was discussed how to disable the PostgreSQL server.
AFAIK, Apache is started as a part of the whole thing, so it should get disabled together with it.
The post is a bit older but the steps should be very similar, if not the same (apart from the PostgreSQL version).
Hope this helps.

Related

How can I reset Apache to its original factory state on Mac

Does anyone know a way to reset apache server configuration to the factory/default state on Mac? I needed to install PHP and phpmyadmin, so I started looking at videos and reading tutorials about how can I do that (with brew) and the result is - I messed up the settings of apache big time... I'm not pretty sure what have I done, but when I try to connect to the server through http://localhost, it just says that Safari can't connect to the server. When I try to start it (sudo apachectl start) it says:
/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded
.. but I can't access it.
Is there a way for me to fix it, or at least troubleshoot it, or if it is needed, to reset my apache configuration to the factory settings?
Thanks a lot in advance! :)

Apache WILL NOT start without the configured ports free,How to fix this error in xampp?

guys I'm a newbie trying to learn php. Just downloaded Xampp but can't find the fix for errors. I downloaded apache 2.4 in the past, but after this problem occurred I stopped Apache services and deleted the folder. It's still having the same problems. Please let me know the fix if you know.
Your previous apache service is still running and use the port, other apache instances can't run on the same port.
You can use task manager to stop your apache service.

Code only works if I use the Xdebug extension

When I started my latest project I learned how to use the xdebug extension and I have been using it ever since. Now I am ready to spin up a server and go in to production with this project and my site doesn't fully work. The frontend pages seem to work, which are php based as well, but the backend endpoints that query the database and return some data to the frontend always are returning a 500 status code. So I attach xdebug and figure out how to run it remotely and the pages all start working without any code changes. I go in to the php.ini file and turn it back off and the pages continue to work. Since this is an AWS EC2 server, I delete the instance and create a new one running the same initialization scripts I wrote to install all the software and I get the exact same issue. The server doesn't work until I follow the xdebug install instructions and restart apache2. And like before even when I unattach the xdebug extension via the php.ini file, the code continues to work. Even after the system is rebooted it still continues to work so whatever is being fixed appears to be permanent.
What would building and attaching the xdebug extension, and restarting Apache2, do to the a LAMP stack that would make my code work, even after the extension has been turned off? My server is being built with scripts that run various apt-get install commands with no binaries provided by me as it all is community provided programs. Like clockwork it breaks every time I rebuild the machine until I apply the extension. I can automate that in to my build scripts if I have to, but it is driving me a bit nuts that I don't understand what is happening.
When the server sends a 500 error, normally you get an entry to the php_error.log. So first check this file. Maybe there is some difference in memory limits, max. post variables etc.
I would suggest you to try to find calls of any xdebug specific functions such as var_dump() or any prefixed by xdebug_ in your code:
https://xdebug.org/docs/all_functions
What would building and attaching the xdebug extension, and restarting Apache2, do to the a LAMP stack that would make my code work, even after the extension has been turned off?
Installing one piece of software can bring with it another. If you sudo apt install php-xdebug without php installed, it will install php.

Adding a variable to httpd.conf file stops Apache from working

In my efforts to solve an OCI8 error, I've been led to believe it is the result of an improperly setup environment variable.
What I'm trying to do: Fix this apache environment headache, by adding variables to a certain file.
My actual problem is similar to this error from another StackOverflow user. To quote his answer to his problem:
Problem solved!
To put variables in Apache's Environment section you just have to add
them in /etc/sysconfig/apache2 file:
LD_LIBRARY_PATH=/path/to/oracle/lib.
Notably, the solution called for the modification of the file apache2.
However, I found no such apache2 file on my system.
What I've done so far:
I searched over the net, but the closest I could come up with is /etc/httpd/conf/httpd.conf file. Assuming the httpd.conf is apache2, according to this thread, I should add the variable to the end of the file, and it should work.
So I added export LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib at the very end of the file.
And... apache won't even start anymore.
My system:
It's a Fedora 19 server, with Oracle 11g, PHP 5.5.4, Apache 2.4.6, and PEAR 1.9.4. In addition to this, I have the OCI8 plug-in for PHP downloaded and enabled, and have downloaded MDB2 and the MDB2_Driver_oci8.
Apache starts automatically when I boot up my system, though if for some reason I need to stop, restart, or check its status, the command I use is systemctl start httpd.service, if it means anything.
Thanks. I've been pulling my hair out on this problem.
A few things (hopefully an answer is somewhere inside)
First off, I wouldn't do this on Fedora. Fedora is the testbed for RedHat Enterprise/CentOS and it changes frequently. Even if this is just for your testing purposes, you'll find better support if you install CentOS 6 instead. The environment is virtually identical, but CentOS is better supported because so many people use it to run their servers.
Second, it sounds like you want to run the OCI8 connector (there's a reason I plugged CentOS 6). CentOS has many good repos like Remi. If you install CentOS 6 you can use his repository. This is important because this will save you a LOT of headaches down the road. Once you have his repo installed, you can do this
yum install php-oci8
And that should configure Apache to run your OCI8 extension. It's really that simple.

Is it possible to install PHP 5 and MySQL on Apache Tomcat 6.0.32 WITHOUT Apache HTTP Server?

There's a webserver which serves dynamic JSP contents, but we would like to serve some PHP contents too.
Is it possible to install PHP 5 and MySQL on Apache Tomcat 6.0.32 WITHOUT stopping the service of current contents, uninstalling Tomcat, installing the Apache HTTP Server (via AppServ, XAMPP or something similar which installs PHP, MySQL and phpMyAdmin too with just some simple clicks), and after that, configuring the Apache Tomcat Connector?
Currently I don't have the opportunity to configure the mentioned "target" webserver, but I installed Tomcat on my local machine, so with my own webserver I can try doing anything suggested.
I know there are lots of questions related to the topic even on stackoverflow, but none of them answered my question.
Thank you in advance!
You could use Quercus or JSR223 + PHP-bridge to read/parse/run PHP files using Java.
As to MySQL, as being just a simple and standalone DB server, it doesn't require a specific webserver. MySQL totally doesn't care wat webserver you're running. Just install and configure it the usual way.
Oh, please note that the Apache Tomcat Connector requires Apache HTTPD server. So if you don't want to install Apache HTTPD, then the Tomcat Connector is worthless to you.
Tomcat supports CGI so why not install php5-cgi?
I don't know whether it's possible to install Apache Tomcat without HTTPD, but I can answer your question partially:
By default, it's not possible. I don't know why, but package-installers (I used YUM at EC2) require you to install HTTPD too as a dependency of PHP. So if your package-installer requires this too, you need to build PHP from source (which isn't very hard though). Edit: I'm using FastCGI, 'just' PHP might not work, but it would surprise me though. (FastCGI works since, just like MySQL, you can install PHP-FastCGI on a separate server).
MySQL is fully independant. Since you can also install it on a separate server (db-server) without PHP and a HTTP-server, it's possible to install MySQL without HTTPD.

Categories