Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to profile some part of my application to make improvements. The recommended way to do this seems to be to enable xdebug in php.ini but this makes it write profiler stuff on every request which is slow and generates a lot of files.
Constantly enabling and disabling would be annoying though.
What I want is to have something I can run from the command line that will run specific requests to particular URLs and write a profiler report to a specific folder when run but not profile the rest of the time.
Make sure that your php.ini contains:
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
Now you can profile a single web page using cURL:
curl -I http://my-website.local/?XDEBUG_PROFILE
Note the XDEBUG_PROFILE query parameter: this is what enables Xdebug's profiler (see the documentation: https://xdebug.org/docs/profiler).
cURL will show us:
HTTP/1.1 200 OK
Date: Tue, 10 Mar 2020 08:45:50 GMT
Server: Apache/2.4.29 (Ubuntu)
X-Powered-By: PHP/7.4.2
X-Xdebug-Profile-Filename: /tmp/cachegrind.out.6173
Content-Type: text/html; charset=UTF-8
The profiler added a X-Xdebug-Profile-Filename header for us that contains the cachegrind file, which we can then open in a program such as KCachegrind.
If that header is not present, you're either using a version of Xdebug < 2.6, or the Xdebug profiler is not configured correctly.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Can I use php7.4-fpm with Apache? Or is php-fpm really only for use with nginx? And why?
Does php7.4 support http2? Or do you still need php-fpm? The official http2 site (http2.pro) hasn't been updated in a couple of years.
Is it Still worth activating HTTP2? (The latest update dates back to a couple of years ago.)
To activate http2 I followed all the procedure described here: https://http2.pro/doc/Apache, now if I have to reactivate php (normal) how do I go back?
(The question was initially much more explanatory, but the administrators didn't like it ... they ask for it to be more focused, so let's try with only the questions.)
PHP-fpm is a version PHP that talks to the outside world with a protocol (a style of communication) called FastCGI. Apache can also talk via fastcgi to the servers it uses to answer requests - in both Nginx & Apache via the php-fpm: master process, that organises the pool of workers that actually run the PHP code. Since Nginx doesn't have mod_php, the only significant way to have it run PHP code is with php-fpm (there are some other methods, but they are not so often used)
HTTP2 is something for the webserver to deal with - Apache, or NginX. PHP doesn't need to worry about it, unless you want to send additional headers that the webserver would then deal with on its behalf (like also sending CSS or .JS files along with the initial connection - this is called HTTP-push, but it's not yet well widely established).
HTTP2 it totally worth it - you will, however, use this alongside the older http v1.0, or v1.1, but it is more efficient for browsers that support it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I follow this guide to install LAMP server on fedora 22 workstation
How To Install LAMP Stack (Apache, MariaDB And PHP) In Fedora 22
Everything working well except phpmyadmin.
When i need access it of the browser
i see nothing (blank page)
How i can fix this issue ?
Any Suggestions ?
Possibly you can get more info via 2 things
1- Enabling php display_errors in php.ini file which you can find by running
php --ini
changing display_errors to on and save it then restart apache web server and revisit phpmyadmin url which should show you the error
2- looking in apache error log which mostly located in /var/log/httpd/error.log
you can use tail -f for better tshooting
tail -f /var/log/httpd/error.log
Try running phpMyAdmin's index.php over the command line. This should give you more information about the error that causes the problem.
php index.php
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm using WAMP and wanted to know if it's ok for the forbidden page to show the services (Apache/PHP) and their version numbers? Is this standard practice?
Thanks
I think for a development system this is good practise while for a production system you should deactivate this feature. To do this you have to change the following lines in your httpd.conf/apache.conf:
ServerSignature off
ServerTokens prod
You would also have to set
expose_php off
in your php.ini to prevent php from showing the php version.
The names of services (Apache/PHP) and their version numbers shown on the 403 forbidden other error pages like that(404 not found, "Internal Server Error" etc.), is called server signature.
Since WAMP is local development environment there is no problem with it.
But for a production server, its not at all a good practice, since every version of Apache or PHP has some points of weaknesses. These maybe exploited by a malicious hacker.
You can disable the server signature by editing your apache2.conf/httpd.conf file.
Add following lines at the end of the file and restart apache
ServerSignature Off
ServerTokens Prod
Back to your question whether or not its a standard practice to show the server signature on error pages, well, for development environment its a standard practice. But for production servers "No its not a good or standard practice"
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have been using Lampp on a test machine. OS is Ubuntu 12.1. It was working fine before and running my scripts. Then it began displaying a pop-up asking me if I would like to open or save the file? I have tried changing the ports and restarted the machine and restart Lampp. Nothing has worked so far though.
Your MIME types are wrong and/or mod_php isn't loaded.
What is in the files? If they contain your PHP code, Apache is serving the files out rather than putting them through PHP. Check you are loading mod_php.
If they contain the output of the PHP code (i.e. the HTML) then they aren't being given the correct MIME types. I'm not sure where this is done, I think Apache or PHP adds the headers automatically. Check the Apache MIME types config
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
I don't know what to do. I read the related question on this site just like mine but those changes didn't work.
First, I edited the httpd.conf file and uncommented the PHP load module line. Next after getting this error "/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument" I changed ULIMIT_MAX_FILES="ulimit -S -n ulimit -H -n to ULIMIT_MAX_FILES="" or some odd thing. That resolved that error.
Then I finally added AddType x-httpd-php .php to the httpd.conf file because that was also mentioned in the previous question here on stackoverflow.
However I still just see my source code in Safari (actually Chrome decided to download the PHP file instead--different problem/story). Then I found a question similar to mine on this site and added some AddHandler lines to the php5.conf file which mimicked the AddType lines in the file after AddHandler. Still didn't work even after a "sudo apachectl restart".
I'm baffled. Please help. I'm just trying to get started so I can learn to program and I feel like I've spent a lifetime just trying to print 'Hello World' in my browser.
Whenever a server side script is being served as a file rather than executed as code, it means your server has not been configured properly. Make sure you have enabled the PHP module in your httpd.conf file and restarted the web server by opening preferences and toggling the "Web Sharing" option in the Sharing pane.
As a commenter noted, however, this is not a programming question but is a server administration question. Go look at the resources in serverfault.