PHP w/ Zend Debugger on OS X 10.5 - php

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.

Related

PHP upgrade issues

I am running a MacBook Air with macOS Sierra 10.12.3. I upgraded my PHP from 5.x to 7.1.1 according to this site and now I am having two issues:
a) The PHP process startup takes around 7 seconds, even for a php -v to print PHP's version. edit: Solved.
b) Apache does not serve my pages anymore locally. Chrome just shows the generic error page with "ERR_CONNECTION_REFUSED". I have restarted the apache service but don't really know what else to do. The apache vhosts config file worked before and still looks good. edit: Also nothing in the apache error logs.
edit: The syslog shows
(org.apache.httpd[71685]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]
(org.apache.httpd): Service only ran for 5 seconds. Pushing respawn out by 5 seconds
Does anyone know how to fix this?
Solved it now.
The issue with Apache was that an additional config file in /etc/apache2/other/+php-osx.conf was created that loaded the php7.1 module, but the module loading of php5 in /etc/apache2/httpd.conf was not disabled.
Loading both obviously crashed apache and commenting out the LoadModule in httpd.conf solved it. I have no idea why the installation routine didn't do that though.
Thank you all for helping me.
https://php-osx.liip.ch is a pretty good site, I used to use it before to upgrade my php installations. I found that time to time it would be untrust worthy and sometimes brick my installation. Edit The scripts used on that site usually compile PHP when ran and this can lead to some interesting quirks and inconsistencies. So I switched to using brew.
Brew is a handy tool for Mac that works a lot like apt-get or yum. I would recommend you try this, it adds libraries in a way that allow you to purge them from your machine and reverting to older versions.
$ brew search php71
# lists all the matches for php71, you will find "homebrew/php/php71"
$ brew install homebrew/php/php71
# installs php71, it will give you some good instructions if there are errors
# typically some permission errors, but it gives commands to run too
$ brew link homebrew/php/php71
# overrides the local php command with "homebrew/php/php71"
$ php -v
PHP 7.1.1 (cli) ...
Then I would suggest looking at PHP Local Server that is built in if its still not working. Although I am 99% sure your issues will be resolved.
In future upgrading your php version is as simple as doing the above again where php71 is your new version (example php72 for 7.2). Removing your old version is easy, although does no harm and does allow you to quickly switch your versions around with a single command line option.

XAMPP Apache not starting because of Apache2.4

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

Activate Apache/PHP on Mac OS X 10.8.3

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

PHP extensions not loading in phpinfo

So I'm running MAMP on Mountain Lion and I've installed gmagick and imagick using pecl, both are relase candidates (mainly because gmagick doesn't have a stable release and imagick 3.0.0 doesn't install, it gives a make error). The modules appear when I run php -i in the terminal but not in phpinfo(), I have checked the php.ini it is the same for both so that is not the issue.However I have installed bitset(which is a stable release) and it appears in phpinfo() and php -i. So my question is does PHP have any configuration option that does not load extensions if they are not stable? Btw, I did restart my server after the changes to the ini file.
You will probably now have two php installations on your machine. Mountain Lion ships with a preinstalled php version. Trylocate php.ini in Terminal to find out how many php.inis are installed.
In your phpinfo() page there is also noted which php.ini is in use. You might want to open the exact php.ini which is used for your phpinfo() and make sure the extentions are loaded.
There should be two lines like
extension=/path/to/gemagicext/gmagic.so
extension=/path/to/imagick/imagick.so
I faced a similar problem with php-fpm and nginx server. The problem was due to the fact that the updated php configuration was not reflected in the current active php-fpm worker processes. I have to manually kill the fpm process and restart it again to have the updated extensions info.
Steps that worked for me:
1) Look for active php-fpm process
ps ax | grep "fpm"
mostly this will list more than one process
2) kill process manually
kill -9 [pid_got_from_previous_command]
3) restart php-fpm process
sudo service php5-fpm start
Note: Trying something like sudo service php-fpm reload or sudo service php-fpm restart didn't work since the old child processes retained the old configuration. Killing the active processes and restarting php fpm what updated the phpinfo for me.
I had the same problem CentOS 6.6 x64, php 5.5.27 and I followed the steps from
http://php.net/manual/en/imagick.installation.php
First of all download a tar image of the ImageMagick install from here:
sourceforge.net/projects/imagemagick/files/
Unpack it and then from terminal issue the following commands:
1. "cd ImageMagick-6.9.1-10" - go where you placed the folder
2. ./configure
3. make
4. make install
5. make check
6. install imagick extension from pecl.php.net/package/imagick/download 3.1.2
7. cd imagick-3.1.2
8. phpize
9. ./configure --with-imagick=/opt/local
10. make
11. make install
12. Copy imagick.so in your PHP extensions folder and add extension=imagick.so in php.ini
Restart apache: service httpd restart
I am sure this problem is related to your extension and PHP server compatibility. I encountered such problems when I created my own extensions. Your extension should compatible with your PHP server in three main attributes:
1- The Zend API number which your PHP server is configured with ( in phpinfo() you can find this number), this number should be the same with your extension header file at build time.
2- The compiler version on your PHP server and your extension must be the same.
3- Thread safety in your PHP server is important. If you use thread-safe server then your extension must be built with php thread-safe library and if you use non-thread safe server you should build your extension with PHP-nts library.

Can't install zend debugger

I'm trying to install zend debugger in my Ubuntu 9.04 machine, I've done it in win. but not in linux, I hope you could help me, this is what I've done:
1)Copied the file ZendDebugger.so to /etc/php5/apache2 (didn't choose this folder for anything in special).
2)Added this lines to php.ini:
zend_extension="/etc/php5/apache2/ZendDebugger.so" zend_debugger.allow_hosts=127.0.0.1,127.0.1.1,localhost,*
zend_debugger.expose_remotely=always
I've also tried without quotes(zend_extension=/etc/php5/apache2/ZendDebugger.so)
3)Copied file dummy.php to /var/www
And then restarted Apache but I didn't see the information about Zend Debugger in the phpinfo(), the only related thing I found there was report_zend_debug On.
Thanks in advance
I found much more easy to install Xdebug in my Ubuntu machine.
sudo mv /etc/php5/apache2/ZendDebugger.so /usr/lib/php5/20060613/ZendDebugger.so
This is where your memcache.so, apc.so, etc. are located. Unless you modified your php extensions directory that is where new exts should go.
In php.ini:
zend_extension=/usr/lib/php5/20060613/ZendDebugger.so
cd to that directory and chmod a-x ZendDebugger.so to remove executable bits from the .so.
sudo /etc/init.d/apache2 stop
In another terminal window, tail -f /var/log/error.log and clear console so it is easy to see new log entries coming in (cmd-k on macos).
Then:
sudo /etc/init.d/apache2 start
If there are no errors in error.log, check phpinfo() and see if the debugger section shows up.
You might get errors in the configuration of other php extensions that occur further up in php.ini (e.g., xcache or eaccellerator) that will make loading stuff further down in php.ini problematic.
This is a baseline setup and should work if there are no other problems.
You can also try to install Zend Server Community Edition
You'll get Zend Debugger enabled by default, along with some other nice features. There is a link to the deb repository available through the download page.
I followed the same steps that you did with the same result. In the end the problem was that I was trying to load a 32bit binary with apache running in 64bit mode base (as described in this post) I was able to get it running immediately by doing the following.
stopping apache
executing sudo arch -i386 /usr/sbin/httpd
restarting apache.
After replacing the 32bit binary with the 64bit binary everything worked as expected with no special apache handling. There was also some facepalming involved, but it did not affect the overall outcome.

Categories