I've been using the 5.4+ built-in webserver in PHP cli, invoked via:
php -S localhost:8080
... and all looks fine on the local PC when accessing http://localhost:8080. So I wanted to test from another device on the local network, but the localhost invocation does not make the server available on the local network. So, I've found that 0.0.0.0 can be used to listen on all interfaces (Running PHP 5.4 built-in web server outside localhost), and I tried that invocation:
php -S 0.0.0.0:8080
Now, I try to access this from the device, and I notice some links cannot be clicked. I try to investigate back on the local PC which hosts the PHP server; and there, when I issue:
http://localhost:8080/dir/
... the server logs it as (there is index.php in /dir/):
[Thu Oct 22 22:56:02 2015] 127.0.0.1:59752 [200]: /dir/
... and this one works fine, no problem.
But when I call the local IP of the computer, for instance:
http://192.168.0.150:8080/dir/
... PHP logs it as:
[Thu Oct 22 22:56:14 2015] 192.168.0.150:57847 [200]: /dir/
... and this page I cannot click ???!!!!???!
So, I saved the server HTML in both cases, ran a diff, and turns out there are differences like:
...
<!-- </div> -->
-<div style="width: 612px;" class="testB my_class" id="testB">
+<div class="testB" id="testB">
<div class="test" id="test">
...
So, basically, the very same instance of the PHP cli server, serves two different pages, based on the address it was called by????!!!
Anyone have any idea why? Version:
$ php --version
PHP 5.5.9-1ubuntu4.13 (cli) (built: Sep 29 2015 15:16:25)
Related
I have a very weird error with symfony. If I create a project with the default project creation command and go into the new folder to start the local webserver I get an error:
Jan 27 17:51:00 |DEBUG| PHP Reloading PHP versions
Jan 27 17:51:00 |DEBUG| PHP Using PHP version 7.4.2 (from default version in $PATH)
Jan 27 17:51:00 |DEBUG| PHP unable to find an available port error="lookup localhost on AN_INTERESTING_IP: no such host" path="/usr/bin/php" php="7.4.2"
Jan 27 17:51:00 |INFO | SERVER shut down, bye!
lookup localhost on AN_INTERESTING_IP: no such host
Yesterday I had no problems to start the local webserver.
Additionally, the interesting thing is, if I start the local webserver in an other non-symfony-directory the webserver starts without an exception.
Maybe someone has experience with this problem?
Kind regards!
I had the same problem today and for some reason the file /etc/hosts lacked an entry for localhost. So I added
127.0.0.1 localhost
After that it worked just fine.
I let my host upgrade php version to 7.2 and after that I am getting error 500 message(Internal Server Error) on my wordpress page.
I am using Virtualmin.
When opening error log I get the following:
[Mon Jan 06 16:04:41 2020] [error] (13)Permission denied: exec of '/etc/httpd/bin/suexec' failed
[Mon Jan 06 16:04:41 2020] [error] Premature end of script headers: php7.2.cgi
I searched for the solution elsewhere but didn't find any solution.
How can I solve this?
You can go to >>> virtualmin >>> serve configuration >> website options
And make the change to
FCGI, fpm or what your system is available
I can't figure out the exact solution, but the web host told me that because this server had somehow been accessed by malware, this whole thing had to be closed down and the domain moved to a new address.
Moving domain to a new server solved this problem.
This would be something to ask your Hosting Provider, Potentially they have changed the PHP Handler (Eg from suPHP to FastCGI)
you have upgraded PHP, but your Virtualmin is not configured to use it correctly.
On Virtualmin go to system settings -> Re-check configuration, Virtualmin will detect new PHP version and configure it to use on your server.
I am having some difficulty using PHP Xdebug with the PHP's internal server provided by later releases of Eclipse. I am running Eclipse for PHP Developers Version: Oxygen.3a Release (4.7.3a). Interestingly enough Xdebug is working quite well with Apache 2, but not the internal PHP server.
Note that the PHP internal server is running. I can use ‘Run As – 1Run on Server’ to run a phpinfo PHP script and a helloworld PHP script. In these cases, the PHP internal server is started with the expected operands. The Linux ps command returns:
/usr/bin/php -S 127.0.0.1:8000 -t /home/peter/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/htdocs
Note that port 8000 is used to start the internal PHP server (correctly as best I can tell) and no –n operand is specified. This causes the /etc/php/7.0/cli/php.ini file to be processed (correctly as best I can tell).
Note that port 80 was originally used to run this server. Of course, port 80 is restricted to root applications. The change to port 8000 was required to get the internal PHP server to start at all.
Also note that checking ‘Use system default php.ini configuration’ and clearing the PHP ini file (optional) field in the PHP Executable preferences was required to get rid of the –n operand.
Also note that I am having some difficulty switching between ‘Run As’ and ‘Debug As’. In some cases I get a message showing that the required port (8000) is already in use. However, I have not found a way to reproduce this problem so far.
Using the procedures described above, the debug internal PHP server was started without the –n operand and is processing the php.cli file. The Linux ps command returns:
/usr/bin/php -S 127.0.0.1:17278 -t /home/peter/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/htdocs
One question is why port 17278 was specified, rather then the expected port (8000). Running phpinfo() shows that Xdebug appears to be installed in the debug internal web server. A few settings include:
xdebug support – enabled
IDE Key – peter (my userid on this machine)
DBGp – Common DeBuGger Protocol - $Revision: 1.145 $
xdebug.remote.enable – on
xdebug.remote.port – 9000
I tried to debug helloworld.php. The console has the following two messages. The first shows a 404 code. The second shows a 200 code:
[Sun Apr 22 17:36:20 2018] 127.0.0.1:50358 [404]: /?start_debug=1&debug_fastfile=1&use_remote=1&ZRayDisable=1&send_sess_end=1
&debug_session_id=1003&debug_start_session=1&debug_port=10137 - No such file or directory
[Sun Apr 22 17:36:20 2018] 127.0.0.1:50362 [200]: /Server-docroou/helloworld.php?start_debug=1&debug_fastfile=1&use_remote=1&ZRayDisable=1&send_sess_end=1
&debug_session_id=1003&debug_start_session=1&debug_port=10137
Note that the debug port is specified as 10137. Perhaps this is causing the problem. Port 10137 is normally used by the Zend Debugger which I am not using.
Does anyone have any ideas? Thank you in advance.
Problem fixed in PDT 6.0 : https://bugs.eclipse.org/bugs/show_bug.cgi?id=533928 ;)
I have a Linux Ubuntu server having Apache2 that runs PHP.
All of a sudden my website gets error:
404 Not Found: The requested URL / was not found on this server
I tried:
sudo service apache2 status
Result:
Apache2 is running (pid 1546)
So I tried:
cat /proc/1546/status
Result:
State: S(sleeping)
Apache error.log file:
[Fri Jul 24 05:22:46 2015] [error] [client 155.124.123.161] File does not exist: /etc/apache2/htdocs
My question is, is this maybe the reason why my Apache server is not working properly that I get Not Found error? Is Sleep state of Apache a problem and what should I do about it? My website codes is in path /var/www/mywebapplication. It is working for a very long time but suddenly it gets error.
Thank you very much.
This is my setup:
Windows XP SP2
WAMP 2.2 (php 5.3.9, apache 2.2.21, mysql 5.5.20)
Symfony 2.0
I run into a problem which is basically this:
Symfony-2.0 vendors Apache
Everything seems to be fine:
Running mysqltest.php connects OK to the database.
localhost/web/config.php is OK (just recommends setting up intl and APC)
"php app/bin doctrine:schema:create" creates the schema successfully.
But, when I try to:
"localhost/web/app.php"
"localhost/web/app_dev.php"
Apache crashes (windows popup saying something about php5ts.dll) and the only meaningful thing on the log says:
[Fri Apr 27 05:03:54 2012] [notice] Child 3528: Starting thread to listen on port 80.
[Fri Apr 27 05:07:00 2012] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Fri Apr 27 05:07:01 2012] [notice] Apache/2.2.21 (Win32) PHP/5.3.9 configured -- resuming normal operations
The solution to the question I referenced previously is to use php 5.4, well, as stated in
How do I get PDO to work on WAMP with PHP 5.4?
besides 5.4 not being officially supported by WAMP, many extensions don't work on 5.4 (APC, PDO maybe?).
Older versions of php are also ruled out. Official WAMP addons exist only for php 5.3.0 and 5.3.1, while symfony2 requires at least 5.3.2.
I also tried this on a Windows Server 2003 machine, with the same results.
This is taking so much time I'm even considering throwing in a Linux VM on the server with my usual symfony setup.
So I need to know whether it's posible to have a stable symfony2/WAMP2.2 environment which does not imply losing extensions and symfony2 functionality such as doctrine.
Any ideas are welcome.
I could not manage to make wampserver work.
I have also tried XAMPP 1.7.7 (php 5.3.8) and other distributions as well and ran into the same issue over and over.
Apparently the error message I have been receiveing is not useful at all, as suggested here, it's just a "something crashed" message.
I couldn't find any other message out of the logs in any of the installations, so I can't tell wether this is a symfony2 bug, a php bug or an apache bug.
Anyway, the error message I got being completely useless, all I could do is moving away from Windows. I setup a LAMP(Linux) environment in virtual machine and run it from a Windos host, it's been some months and I haven't had any issues so far.
I added the following lines at the end of my 'httpd.conf' file of the running Apache server based on the explanation given here:
<IfModule mpm_winnt_module>
ThreadStackSize 8888888
</IfModule>
And so far didn't get any issues.