LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-16-2018, 10:36 AM   #1
gginnj
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Rep: Reputation: Disabled
php takes almost 3 seconds to start from command line


If I just type 'php -v' it takes about 2.5 seconds to display the version number
same for if I execute a php script.

Is this normal? when I run php from WAMP it executes immediately.

I'm running fedora 19 - with php 5.5.4 (yes, I know, the OS is not current....)

This seems to be only with the command line, running a web page script does not have the delay.

Thanks
GG
 
Old 05-16-2018, 03:16 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
try ' strace php -v ', maybe you'll find some hints from output
 
Old 05-16-2018, 03:23 PM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
I wonder if it is a CLI php.ini problem. What happens when you run the command

/usr/bin/php -n -v
 
Old 05-16-2018, 03:44 PM   #4
gginnj
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
I wonder if it is a CLI php.ini problem. What happens when you run the command

/usr/bin/php -n -v
That worked fine...

What in the config file that could cause that?

I also tried another server (even older OS....) and it was fine.

Thanks
GG
 
Old 05-16-2018, 03:48 PM   #5
gginnj
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by keefaz View Post
try ' strace php -v ', maybe you'll find some hints from output
didn't have strace - I installed it - however it just flings a bunch of stuff on the screen that's not STDOUT so I'm not sure if it's output or errors within that utility.

GG
 
Old 05-16-2018, 03:51 PM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by gginnj View Post
didn't have strace - I installed it - however it just flings a bunch of stuff on the screen that's not STDOUT so I'm not sure if it's output or errors within that utility.

GG
I hoped it would have give hints at the moment when it hangs, but it seems michaelk helped better to narrow the origin of problem
 
Old 05-16-2018, 04:05 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
There are two php.ini files, one for the web server and one for the command line interpreter. Is this something that recently happened or is this the first time you have tried running a php script from the command line?

Does it exist i.e /etc/php5/cli/php.ini?

You can view the CLI configuration via the following command which might help point you in the correct direction.

php -i
 
Old 05-16-2018, 04:41 PM   #8
gginnj
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
There are two php.ini files, one for the web server and one for the command line interpreter. Is this something that recently happened or is this the first time you have tried running a php script from the command line?

Does it exist i.e /etc/php5/cli/php.ini?

You can view the CLI configuration via the following command which might help point you in the correct direction.

php -i
no, it's been happening all along - I never really thought it was an issue, until I loaded WAMP and noticed it didn't have the delay.
My .ini in at /etc/php.ini

Nothing gets flagged in the error files or the system logs

I may start commenting out things I don't use....only keeping mysql - no mssql, sybase, postgres, etc.
I compared the two .ini files between the other server, and nothing was really different

If not, I'll have to start with a fresh .ini and add things in until it slows up.....
 
Old 05-16-2018, 05:14 PM   #9
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You can try removing settings with method, eg:

backup, copy php.ini file to another place
remove half of the php.ini file, test php cli...

If it hangs, setting problem is in this half of file content, else it's in the other half in that later case replace php.ini content with the removed settings using backup copy

repeat removing half of settings until you narrow it down
 
1 members found this post helpful.
Old 05-17-2018, 08:41 AM   #10
gginnj
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by keefaz View Post
You can try removing settings with method, eg:

backup, copy php.ini file to another place
remove half of the php.ini file, test php cli...

If it hangs, setting problem is in this half of file content, else it's in the other half in that later case replace php.ini content with the removed settings using backup copy

repeat removing half of settings until you narrow it down
This was very effective - narrowed it down in under 5 minutes!

It's seems to:

[browscap]
browscap = /etc/browscap.ini


I have one program (a web program) that uses get_browser, which also always seems to have this delay which I could never figure out....hmmmm
May have to rethink if I need this functionality.

Will start a new topic on this one......

Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernation takes ~10 seconds only once after a reboot; After resume, it takes about 3-4 minutes. geni4u Linux - Laptop and Netbook 10 01-21-2018 01:07 PM
[SOLVED] libvirt: libvirtd often takes ~45 seconds to start atelszewski Slackware 14 02-07-2017 06:35 AM
mc takes 30 seconds to start slackware current zasavage Slackware 11 05-10-2012 01:58 PM
Apache PHP != Command Line PHP? wh33t Linux - Server 3 10-23-2007 09:21 PM
HELP !!! compression only takes a few seconds lukman Linux - Newbie 1 06-15-2006 01:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration