I have a MacBook Pro with OS X 10.8.3 factory installed. I want to set up a working Apache/PHP environment on my local machine. Is this a matter of activating/changing settings in Terminal or do I need to install something?
There have been other guides out there but they don't explicitly answer how to begin if I have a factory installed OS and not an upgrade from an earlier version.
Thanks for any help.
If I'm not mistaken, all you have to do is edit the httpd.conf (/etc/apache2/httpd.conf) file to load the php module into apache (Look for 'LoadModule php5_module', it will probably be there, but with a # at the beginning of the line, simply remove it) and then start apache by entering this in terminal: apachectl start (you will maybe need to put 'sudo' before)
Of course this will only run apache and php. After that you can change your documentRoot and all the settings you want
I found a guide that'll walk someone through getting the factory installed Apache and PHP working on OS X 10.8. It goes over getting MySQL installed too:
http://coolestguyplanettech.com/downtown/install-and-configure-apache-mysql-php-and-phpmyadmin-osx-108-mountain-lion
Related
Apache won't start on Mac with XAMPP. I tried updating PHP from 5.5.6 to PHP 5.6.8, and since that update XAMPP wouldn't start Apache. I tried completely re-installing XAMPP, but same issue.
Help would be appreciated, I'm more than happy to post any information that is necessary, not sure where to start. I've done a lot of looking around and haven't been able to find anything that points me in the right direction - I checked the Apache error_logs and there aren't any.
Try this -
Solution#1
This solution worked perfectly fine for me..
1) Close XAMPP control
2) Open Activity Monitor(Launchpad->Other->Activity Monitor)
3) Select filter for All processes (default is My processes)
4) In fulltext search type: httpd
5) Kill all httpd items
6) Relaunch XAMPP control and launch apache again
OR, Solution#2
sudo apachectl stop
This command kills Apache server that was pre-installed on MAC OS X.
OR, Solution#3
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
This will disable OSX's built-in Apache server and allows XAMPP to start on 80.
Now once Apache starts successfully modify the .htaccess file
Apache needs to be configured to recognize index.php as an index file. While adding 'DirectoryIndex index.php' to a .htaccess file may work,
NOTE:
In general, you should never use .htaccess files
This is quoted from http://httpd.apache.org/docs/1.3/howto/htaccess.html
Although this refers to an older version of apache, I believe the principle still applies.
Adding the following to your httpd.conf (if you have access to it) is considered better form, causes less server overhead and has the exact same effect:
<Directory /myapp>
DirectoryIndex index.php
</Directory>
I've updated PHP to 8.0 in xampp by renaming old PHP folder to PHP_7.4
and new pasted new php8 folder as php folder, it gave me same error,
SOLUTION
Step1: backup old php folder,
Step2: Paste php8 files in to old PHP folder and overwrite existing files,
Done: Restart Apache it should start
So I'm starting to use MySQL and phpMyAdmin and I firstly installed Apache2.4. After installing Apache2.4 there were numerous errors so I decided to install XAMPP instead. Now me not thinking through the consequences deleted the Apache2.4 Folder completely along with all its contents.
So now when I start XAMPP, MySQL runs fine but Apache is stuck on "Attempting to start Apache service..." Now when I look at the services tab Apache2.4 is still on my list, I have disabled it but it's made no difference. I have checked through my computer for any remaining Apache2.4 files but I can't find any.
If anyone can help me with this, it would be extremely helpful!
UPDATE: I have restored Apache24 from my recycling bin, should I attempt a uninstall using cmd?
It appears that an instance of apache 2.4 is running on the system. It is probably locking port 80 which the reason why XAMPP apache is unable to start.
Shutdown apache 2.4 from it's control panel, shutdown the service, and ensure there is no "httpd" process running using task manager. If there is kill it.
Once the above are done you should be able to start xampp.
Follow those steps:
1- Uninstall Apache 2.4
2- Clean Windows Registry with a tool like CCleaner
3- Restart Windows
4- Install XAMPP
I'm trying to find the path of the uninstall file for apache 2.2. I can see it in add/remove programs, and tried to find the uninstall path in the registry under HKLM\software\microsoft\windows\currentversion\uninstall but there is no folder for apache...
I'm trying to find the path because I'm making an install file which installs apache/php/mysql and want to uninstall any existing installations of those 3 beforehand.
I know that running the apache installer gives you the option of repair/remove if its already installed but I want the uninstall to be silent/automated, so that the end user doesnt have to manually select remove to actually uninstall the existing apache.
I hope this makes sense, thanks in advance.
On my WinXP x32 laptop there is a key for Apache (2.2.13), installed with the MSI, under
HKLM\software\microsoft\windows\currentversion\uninstall
...and the uninstall string is
MsiExec.exe /I{UUID of key}
Just checked a Win2003 machine (Apache 2.2.19) at work and it is the same.
This probably doesn't help you very much, because you need to find the key before you know which UUID to pass to msiexec.
Looking through the other keys, this seems to be similar for all packages that were installed with MSIs.
Which version of Apache are you looking at? Because some older releases in the 2.2 branch didn't use MSI (if I remember rightly), I think they may have used InstallShield?
How did you originally install apache? Most of the time on Windows it is installed with XAMPP, WAMP, or some other similar bundled package. Try a search for php.ini or apache.conf, then look at the directory structure. That should point you in the right direction, you could also try
apache -k uninstall
Also take a look here http://support.esri.com/en/knowledgebase/techarticles/detail/23569
Here are the instructions I followed when I uninstalled my Apache server on Windows 7: http://www.ehow.com/how_7361546_uninstall-apache-windows.html
And one more thing, when doing the command prompt instruction, be sure to run it as Administrator or it will tell you that access is denied.
I've set in my custom.conf file in apache2 this:
SetEnv PATH $PATH:/opt/local/lib/mysql5/bin:/this-is-a-test
However it's not working. When I call:
$hey = shell_exec('env'." 2>&1"); var_dump($hey);
I get:
... PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin
Can anyone help? I'm on Mac using Macports for my development environment.
Thanks!
for ubuntu server, in /etc/apache2/envvars,
for centos server, in /etc/sysconfig/httpd,
to add:
export PATH=<your php cli path>
and restart apache
That seems awfully strange to me that you are trying to set the PATH from within Apache. Instead, you should be setting the PATH for your system. There are several ways to do this in Mac OS X:
User-specific
For a single user, you can edit ~/.profile and add:
export PATH="$PATH":/opt/local/lib/mysql5/bin:/this-is-a-test
Or you can create/edit ~/.MacOSX/environment.plist and define the PATH that way.
System-wide
On newer versions of Mac OS X, there is a file named "/etc/paths" and there is a folder named "/etc/paths.d" that allow you to extend the default paths. Basically, you would create a file in "/etc/paths.d" that lists all the paths that you wish to add to the default paths. On versions of Mac OS X that do not support this (you can tell based on whether "/usr/libexec/path_helper" exists), one can edit the default paths for all users by placing the export statement above in /etc/profile.
This question is old, but in case it helps others, if you are using Windows with mod_fcgid check if you have the FcgidInitialEnv set in your httpd.conf, and remove it to adopt the System PATH.
Macports Apache 2.4 install
The only way I have found to get this to stick on a reboot is to edit the macports apache2.plist. Steps I took:
1.sudo /opt/local/sbin/apachectl stop
2.Edit plist: /opt/local/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist
And add:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:{add paths here}</string>
</dict>
3.sudo port unload apache2
4.sudo port load apache2
5.sudo /opt/local/sbin/apachectl start
Paths stick on a reboot. However the plist will probably be wiped on the next macports update I do.
EDIT : And this proved to be true. I upgraded to Mojave with an associated macports update, and had to re-apply the steps above
I have OS X 10.5 set up with the precompiled versions of PHP 5 and Apache 2. I'm trying to set up the Zend Debugger, but with no luck. Here's what I did:
I downloaded ZendDebugger-5.2.14-darwin8.6-uni.tar
I created the directory /Developer/Extras/PHP and set the permissions to:
Permissions: drwxrwxr-x
Owner: root:admin
I copied ZendDebugger.so from the 5_2_x_comp directory to /Developer/Extras/PHP
I updated /etc/php.ini file, adding the following lines:
zend_extension=/Developer/Extras/PHP/ZendDebugger.so
zend_debugger.expose_remotely=always
zend_debugger.connector_port=10013
zend_debugger.allow_hosts=127.0.0.1
I restarted Apache via the System Preferences "Sharing" panel
When I run phpinfo() within a PHP file, I get no mention of the Zend Debugger. When I run php -m from the command line, it shows the Zend Debugger is loaded. Both state that they're running the same version of PHP, and loading the same INI file.
Anyone have another suggestion for me to try?
If I remember correctly, this problem is do to the fact that the Zend Debugger is compiled for 32-bit Apache while the Apache that comes with Max OS 10.5 is compiled as 64-bit application. Until Zend comes out with a 64-bit version, you have two options:
1) Restart Apache manually into 32-bit
2) Recompile Apache and PHP in 32-bit mode.
I haven't actually gotten around to doing either yet, but I think I am leaning to recompiling to avoid future problems.
Restarting in 32-bit mode did the trick. For those of you who want to be able to do this easily, here's a little bit of AppleScript:
do shell script "apachectl stop" with administrator privileges
do shell script "arch -i386 /usr/sbin/httpd" with administrator privileges
It's nice to have sitting somewhere so you can quickly pop into 32-bit mode when needed.
Zend released the 64bit version for Mac OSX, so just download the file from http://www.zend.com/en/products/studio/downloads and procede as normal.
You will have to register and answer some questions, but it worked for me.
Good Luck.
Me too, HOURS!! Thanks so much!!
Also if for some reason you need to restart apache/httpd after running this (e.g. you need to make a change in your php.ini) but when you run "sudo arch -i386 /usr/sbin/httpd" you're getting this error:
(48)Address already in use: make_sock: could not bind to address [::]:80
type this in a terminal window:
sudo killall httpd
then "sudo arch -i386 /usr/sbin/httpd" should work fine to restart apache/httpd.