Execute PHP in the command line.

Source: Internet
Author: User
In the command line, the PHP version I used is 5.2.13,
Running quickly in Apache,
That is, when you open the cmd command prompt for execution, it will be inexplicably 'dump' (about five seconds)

Such as a simple file a. php:
   

Execute> php a. php in the command line. in about one second, the output string is displayed. after four seconds, the program ends.

When the extension php_curl.dll is removed from php. ini, the speed becomes faster (press enter and the program is executed)

I wonder if you have ever encountered this phenomenon. my system is win7 64-bit,
Because the online PHP version is 5.2.14, I chose a version similar to that of 5.2.14 ...) Used as a local development environment.


Reply to discussion (solution)

This problem is not very serious, that is, sometimes I want to write a simple piece of code and debug it in the command line. every execution takes five seconds, which is quite difficult. It's just curious, the system, the program, and the configuration are all correct. On the contrary, Apache runs fast...

During php running, it takes time to load all extension libraries and corresponding support libraries indicated in php5ts. dll and php. ini.
Because you run the command line, when php.exe exits, all the loaded dynamic link libraries will be uninstalled.
Different from Apache, because http.exe does not exit, the loaded dynamic link library will not be uninstalled.
In comparison, Apache is faster.

You load a large number of databases, so it slows down.
For the reason, see upstairs.

Google, it seems like this is a bug.
Https://bugs.php.net/bug.php? Id = 50410

During php running, it takes time to load all extension libraries and corresponding support libraries indicated in php5ts. dll and php. ini.
Because you run the command line, when php.exe exits, all the loaded dynamic link libraries will be uninstalled.
Different from Apache, because http.exe does not exit, the loaded dynamic link library will not be uninstalled.
In comparison, Apache is faster.



Because I don't load the php_curl.dll extension, the speed is very high, so I think it should not be caused by loading too many libraries...

Is your production environment windows? if your production environment is linux, you can use virtual machines to build the environment locally. Now it is very convenient to use vagrant or boot2docker, and you do not need to allocate much memory to virtualbox.

Is your production environment windows? if your production environment is linux, you can use virtual machines to build the environment locally. Now it is very convenient to use vagrant or boot2docker, and you do not need to allocate much memory to virtualbox.



I'm a Windows 64-bit flagship edition. I have never heard of the software you mentioned.

Google, it seems like this is a bug.
Https://bugs.php.net/bug.php? Id = 50410



The number of root related:
It seems to only affect PHP 5.2.11 and 5.2.12, as I wasn't able to reproduce it with 5.2.10 using the exact same php. ini file.
Confirmed on Windows 7 and XP.


Google, it seems like this is a bug.
Https://bugs.php.net/bug.php? Id = 50410



The number of root related:
It seems to only affect PHP 5.2.11 and 5.2.12, as I wasn't able to reproduce it with 5.2.10 using the exact same php. ini file.
Confirmed on Windows 7 and XP.



Well, the above description is very similar to what I encountered. it seems that it is a problem of PHP itself, regardless of it...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.