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.
Related
I know this is a newbie question, but i want to study php. i have phpeclipse and its running well, the problem is when i run a simple html file with the default server the page says cant display this page and thats it. i dont know if i need to install a new server or is there something wrong with the server configurations. ive tried installing tomcat on my computer but i cant see it under windows->preferences->server->runtime enviroments->add. iv also tried under the same page to fetch geronimo v2.2 and 3.0 and the dependencies were wernt satisfied. iv also tried the repository for zend debugger. what do i need to do in order to compile and see php and html pages with php eclipse?
You don't need to compile PHP.
Depending on your operating system and PHP version there are a few options.
As of PHP 5.4+ you can run your application using PHP's built in server, on the command line, if you cd into your website root directory (i.e. where the index file is) and then run the following
php -S localhost:8989
Then if you navigate to http://localhost:8989 in your browser you should see your application.
If you are unable to run the inbuilt web server, you need to look at Apache2. Most PHP websites run inside the Apache 2 web server. You will generally need a *AMP (WAMP/LAMP) environment.
L/W (Linux / Windows)
A pache (Web server)
M ySQL (Database)
P HP
Hope this is enough of a pointer ;)
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.
I'm hoping someone can help me with this, as I've kinda hit a wall. Here's the situation:
I'm currently setting up a knowledge base using MediaWiki. I'm using XAMPP to aggregate my tools. The site itself is working fine, and coming along nicely.
I'm now trying to set up a cache to speed things up. I've opted to use PHP APC, as it is recommended for MediaWiki. The troubles started here.
Current versions are:
PHP: 5.4.4
Apache: 2.4.2 (apache2handler)
SQL: 5.5.25a
XAMPP: 1.8.0
MediaWiki 1.19.1
I am currently using Windows, so the first issue I had was finding the correct php_apc.dll file for my PHP. I tried numerous versions unsuccessfully (with log errors stating the .dll cannot be found). I eventually was able to secure a version which seems to work, APC 3.1.14 for PHP 5.4, downloaded from http://dev.freshsite.pl/php-accelerators/apc.html. It is the TS version, as this option is enabled on my PHP.
Now, with this presumably correct version of APC, Apache is now able to start fine. phpinfo() also shows the APC extension as available. The problem is now that no pages on the wiki will load. Precise situation is that:
All pages on the Wiki do not load (IP/mediawiki/*)
Pages on XMAPP itself do seem to load correclt (IP/XAMPP/*).
Other utilities are not able to load either, (e.g. phpMyAdmin).
No error messages seem to be created either in apache logs or php logs. Now, I am by no means an expert on this.
I have confirmed that environment variables in Windows TMP and TEMP both point to the same folder (C:\WINNT\TEMP), on which I gave "everyone" full access rights.
Here is an image showing the phpinfo() for APC that I can see:
http://i.stack.imgur.com/hYHwP.png
Any ideas?
edit: I forgot to mention: there actually are 0kb sized files that seem to be related to APC being created under c:\winnt\temp. For instance, one of them is called ".apc.a02684".
This has come up previously on the MediaWiki Support Desk. MediaWiki apparently doesn't run under Apache 2.4.
I'm trying to install NewRelic on my website, I use PHP, cPanel(VPS/dedicated) and Centos (64bit) for my server, I've installed the server monitoring part right on my server but when I try to install the 'app' part on my server I can't get that to install, I followed the instruction links http://newrelic.com/docs/php/new-relic-for-php
but to no success, has anyone got any ideas as to why this maybe? I have restared httpd and appache multiple times and given it some time to propogate etc..
The problem of this is having WHM installed and many PHP services installed, you should try this guide I found:
New Relic for PHP w/cPanel
We have few dedicated servers on HostGator. Few months back we had installed "NewRelic" on our server for monitoring, later we started having issues and here is what HostGator Tech Team said
"While it's possible to configure a cPanel server to use a non-cPanel
PHP version, it's complicated to configure and we will not support it
or set it up. PHP gets compiled from source by cPanel normally and it
should be left this way, as it interacts with a number of other
components on the server in complicated ways, as you found out today.
We recommend completely removing the custom "Newrelic" repository as
well as the packages it installed in order to avoid further
compatibility problems."
and here is what "NewRelic" team said
"I wasn't trying to suggest that Hostgator's assertion was wrong. I
was just trying to figure out which instructions to go over with you."
Make sure to check compatibility before installing it. Installation instruction can be found at http://www.networkredux.com/answers/view/Hosting/Control_Panels/WHM/cPanel/162
New Relic Needs to document this cpanel compatibility better, I know it's my fault for not researching but while using a hostgator dedicated server with cpanel/whm I got new relic up and running. . then my server became a huge mess if improperly configured files and a few days of reading and learning to get it straightened out - I understand my fault entirely but a big ass CPANEL/WHM <- CAREFULL sign might have helped :P
In the past, I used WAMPserver on windows to parse PHP for me. This is a pre-configured package, focussed on working with MySQL.
When I tried to run PostgreSQL, I got error messages that said that my version of PHP wasn't compiled to work with PostgreSQL.
So, I've recently uninstalled WAMP and every associated with it. I've downloaded Apache 2.2.11 with openSSL, installed as admin(you know, run the command prompt as administrator, cd to the directory where the download was done and have it executed, so the install was done as admin).
That's that. I now have Apache installed, "it works" shows up, so I'm that far.
Now I'm wondering, do I download the exe and install, or the zip, or something else.
What is the best thing to do to make sure that the PHP on my system can handle everything I can ever throw at it?
Also, PHP first, or MySQL/Postgre first.
And lastly, what about PEAR? I need PEAR installed, which isn't standard on Windows. I'm guessing the pear.bat file in the PHP downloads will do that for me?
EDIT: I see one close vote, yet no comment as to why. It makes me wonder how people who are so lazy and rude got to have somany points.
I would recommend downloading the zip package, as configuring php is not really that difficult, and it allows you to add features as needed.
As for whether first to install php or MySQL/PostgreSQL, - it does not really matter. You can install them in any order.
Your guess regarding PEAR is quite correct
i haven't used wamp before, so i can't comment on that
i do however use xampp which sounds very similar
in xampp if i want to enable postgres support i edit the php.ini file and uncomment the postgres section of the ini file, same with any of the extensions that i need
perhaps this might be an alternative you can try if you get stuck
There are many ways to setup a HTTP server/PHP/database machine. Sometimes the behaviour of your development setup will differ from the live server's.
I would recommend finding out the setup your web host is using, then getting a vmware appliance image that fits that as close as possible and get any additional software using it's package manager (which is easier that installing stuff on Windows).
Setup a file sharing link between the VM and the host, make sure you can view the VM's port 80 in a browser running in your host OS and you're set.